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 :: how to extract column from numpy array 
Python :: ide for python 
Python :: how to swirtch the placement of the levels in pandas 
Python :: pandas convert hex string to int 
Python :: join two strings python 
Python :: convert float with missing values to integer 
Python :: django delete table data 
Python :: docker run python 
Python :: pyhton comment 
Python :: Align axis labels in subplots 
Python :: how to get all 5 letter words in python 
Python :: .corr() python 
Python :: binary tree python implementation 
Python :: compare dates in python 
Python :: python tkinter cheat sheet 
Python :: SystemError: error return without exception set 
Python :: python largest common divisor 
Python :: distribution analysis pandas 
Python :: columnspan tkinter 
Python :: Selenium get response body python 
Python :: python get time executed by function 
Python :: treesitter python 
Python :: how to play audio in python using pygame 
Python :: fill column based on values of another column 
Python :: pandas transform count where condition 
Python :: open multiple urls 
Python :: controlling the mouse with pynput 
Python :: id3 algorithm code in python 
Python :: embed python discord 
Python :: python datetime to unix timestamp 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =