Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
Python
2022-01-31 02:17:20
python read binary trj file
with open(fileName, mode='rb') as file: # b is important -> binary fileContent = file.read()
Add solution
Python
2022-01-30 13:16:44
python read text file into string
with open('data.txt', 'r') as file: data = file.read().replace('\n', '')
Add solution
Python
2022-01-24 00:46:46
python readlines without n
temp = file.read().splitlines()
Add solution
Python
2022-01-22 17:40:24
read a text file in python
with open ("data.txt", "r") as myfile: data = myfile.read().splitlines()
Add solution
Python
2021-11-20 12:04:10
python read file to variable
with open('data.txt', 'r') as file: data = file.read().replace('\n', '')
Add solution
Python
2021-11-12 11:36:17
get all classes from css file using python
regex = r"(\.\w+.(.*?)\})" # add the class name after . toget related classes classes = re.findall(regex, infile.read()) for entry in classes: outfile.write(entry[0] + '\n')
Add solution
Python
2021-11-09 12:47:11
python tkinter askopenfile
file = askopenfile(mode ='r', filetypes =[('Python Files', '*.py'), ('Text Files', '*.txt')]) if file is not None: content = file.read() print(content) file.close()
Add solution
Python
2021-11-03 07:30:13
convert pdf to base64 python
# credit to the Stack Overflow user in the source link import base64 with open("book.pdf", "rb") as pdf_file: encoded_string = base64.b64encode(pdf_file.read())
Add solution
Python
2021-10-28 05:53:10
base64 python flask html
with open("sample.jpg", 'rb') as image_file: image_64_encode = base64.b64encode(image_file.read()).decode("utf-8")
Add solution
Javascript
2021-10-17 23:13:08
python json replace string
with open('file.json', 'r+') as file: content = file.read() file.seek(0) content.replace('string_replaced', 'new_string') file.write(content)
Add solution
‹
1
2
3
4
›
Best helpers
daily
weekly
monthly
for 3 months
Ranking is empty
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Welcome Back!
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.