Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: 4 byte hex byte swap from binary file
Post: RE: 4 byte hex byte swap from binary file

(May-07-2018, 08:34 PM)DeaD_EyE Wrote: It's good to know which datatype it should be. Which format is the texture? In [8]: struct.unpack('<i', b'\x00\x80\x00\x00') # < is little endian Out[...
medievil General Coding Help 7 22,051 May-08-2018, 12:53 AM
    Thread: 4 byte hex byte swap from binary file
Post: RE: 4 byte hex byte swap from binary file

(May-07-2018, 08:21 AM)killerrex Wrote: What you are describing is easy to do with the bytes type: # This can be the result from # with open('file.bin', 'rb') as fd: # a = fd.read(4) >>>...
medievil General Coding Help 7 22,051 May-07-2018, 04:40 PM
    Thread: 4 byte hex byte swap from binary file
Post: 4 byte hex byte swap from binary file

can't seem to find a solution that works. the program I am working on basically takes a bunch of specially formatted texture files and dumps them into one large file with a special header (And subhead...
medievil General Coding Help 7 22,051 May-07-2018, 04:30 AM
    Thread: just a couple questions....
Post: RE: just a couple questions....

ok I am pretty much all set, just one final question.. is it possible to get the file list (so i can auto open files in a directory) from a folder the user inputs?? I tried this but it didn't work s...
medievil General Coding Help 5 3,600 May-05-2018, 03:13 AM
    Thread: just a couple questions....
Post: RE: just a couple questions....

(May-04-2018, 05:35 PM)j.crater Wrote: Thanks for sharing the solution, glad you got it sorted :) yea, now I ran into the opposite issue, reading a single byte as hex (or even decimal) so I can do s...
medievil General Coding Help 5 3,600 May-04-2018, 11:16 PM
    Thread: just a couple questions....
Post: RE: just a couple questions....

in case anyone else ever needs that answer I found it... w.write(struct.pack("<i", number))that will write the single value in Hex form into a binary file
medievil General Coding Help 5 3,600 May-04-2018, 04:40 PM
    Thread: just a couple questions....
Post: ok, figured most of my stuff out, however...

ok, figured most of my stuff out, however... How the flip do you store a 00 into another file??... (chr(var)) reads it as null/none and crashes..I need it to be an integer cause it is part of a count ...
medievil General Coding Help 5 3,600 May-04-2018, 02:33 PM
    Thread: just a couple questions....
Post: just a couple questions....

Regarding file input/output... Small project I am working on will require me to take a bunch of xxxx files, strip out various infos and create small subheaders with pointers to the data section...I kn...
medievil General Coding Help 5 3,600 May-03-2018, 11:15 PM

User Panel Messages

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