Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python write data to file with permissions

#!/usr/bin/env python3
import stat
import os
path = 'outfile.txt'
with open(path, 'w') as fh:
    fh.write('blabla
')
st = os.stat(path)
os.chmod(path, st.st_mode | stat.S_IWOTH)
Comment

PREVIOUS NEXT
Code Example
Python :: using python for rest api 
Python :: how to make a new key in a dictionary python 
Python :: newtorkx remove node 
Python :: flask stream with data/context 
Python :: make array consecutive 2 python 
Python :: pandas check length of string 
Python :: sklearn tree visualization 
Python :: speech to text 
Python :: rank function in pandas 
Python :: pytest for loop 
Python :: check command 
Python :: how to sum numpy matrix diagonal 
Python :: python pathlib os module 
Python :: node 14 alpine add python 
Python :: python sh command 
Python :: how to get the top 100 frequent words on a python dataframe colummn 
Python :: print in pytest python 
Python :: Generate random numbers following Poisson distribution, Geometric Distribution, Uniform Distribution, and Normal Distribution, and plot them 
Python :: Access Google Photo API with Python using google-api-python-client 
Python :: change folder icon with python 
Python :: python selenium click on agree button 
Python :: how to input a picture into opencv raspberry pi 
Python :: reshape 
Python :: find the difference of strings in python 
Python :: python last column of array 
Python :: extract decimal number from string python 
Python :: tensorflow create custom initializer 
Python :: python for loop practice problems 
Python :: how to sort values in python 
Python :: how to exit a loop in python 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =