You can use this:
f = open("ex.txt","w+")
Here the first argument ex.txt is the filename and w means the file has to open in the write mode and + will make sure a new file called ex.txt is created if it does not exist.
Hope this is helpful!
To know more join Master in Python programming course today.
file = open('text.txt', 'w+)
To print the message that file is not ...READ MORE
Hi. Good question! Well, just like what ...READ MORE
a = int (input('enter number'))
num = a
sum ...READ MORE
You can also use the random library's ...READ MORE
colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
Every occurence of "foreach" I've seen (PHP, ...READ MORE
Hi, there is a very simple solution ...READ MORE
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.