Python Forum
What is meant by "truncates the file" RE file.open(w+b)?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is meant by "truncates the file" RE file.open(w+b)?
#5
As bowlofred says, there is no such thing as "insert mode". If you want to "insert" something in a file you need to rebuild the file. This is not a "Python" thing. This is a "how all files work" thing.

As for your other questions, they are best answered by doing some experiments. Open an existing file using "w" and close it immediately. What happened to the file size?
Reply


Messages In This Thread
RE: What is meant by "truncates the file" RE file.open(w+b)? - by deanhystad - Sep-01-2020, 08:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Open/save file on Android frohr 0 363 Jan-24-2024, 06:28 PM
Last Post: frohr
  file open "file not found error" shanoger 8 1,272 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Need to replace a string with a file (HTML file) tester_V 1 800 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  How can i combine these two functions so i only open the file once? cubangt 4 919 Aug-14-2023, 05:04 PM
Last Post: snippsat
  How can I change the uuid name of a file to his original file? MaddoxMB 2 991 Jul-17-2023, 10:15 PM
Last Post: Pedroski55
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,155 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  I cannot able open a file in python ? ted 5 3,536 Feb-11-2023, 02:38 AM
Last Post: ted
  testing an open file Skaperen 7 1,434 Dec-20-2022, 02:19 AM
Last Post: Skaperen
Thumbs Up Need to compare the Excel file name with a directory text file. veeran1991 1 1,169 Dec-15-2022, 04:32 PM
Last Post: Larz60+
Photo Making Zip file of a file and Directory Nasir 2 1,064 Oct-07-2022, 02:01 PM
Last Post: Nasir

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020