[Tutor] File extension against File content

2019-05-31 Thread Sunil Tech
Hi Tutor, Is there any way that I can actually programmatically compare the file extension with its content? This is because we can manually save the file in one extension and later rename the file extension to some other. Thanks - Sunil. G ___ Tutor m

Re: [Tutor] File extension against File content

2019-05-31 Thread ingo
Many file formats have "magic bytes" that you can use for that purpose. https://en.wikipedia.org/wiki/List_of_file_signatures Ingo On 31-5-2019 12:03, Sunil Tech wrote: > Hi Tutor, > > Is there any way that I can actually programmatically compare the file > extension with its content? > > This

Re: [Tutor] File extension against File content

2019-05-31 Thread Cameron Simpson
On 31May2019 12:38, ingo wrote: Many file formats have "magic bytes" that you can use for that purpose. https://en.wikipedia.org/wiki/List_of_file_signatures Also, UNIX systems ship with a command called "file" which inspects a file's leading data for such magic numbers to identify their cont

Re: [Tutor] File extension against File content

2019-05-31 Thread Alan Gauld via Tutor
On 31/05/2019 11:03, Sunil Tech wrote: > Hi Tutor, > > Is there any way that I can actually programmatically compare the file > extension with its content? For images the standard library offers imghdr I'm not sure how reliable or accurate it is but it claims to identify a dozen or so of the mos

[Tutor] is this doable

2019-05-31 Thread nathan tech
Hi there, So for a future project of mine, I was wondering something. Is it possible, in python, to store a running task id in the registry? I might be using the complete wrong terms here, because I'm only used to doing this with a specific language, but here's what I want to do: python mytes

Re: [Tutor] is this doable

2019-05-31 Thread Cameron Simpson
On 31May2019 19:41, nathan tech wrote: Is it possible, in python, to store a running task id in the registry? I might be using the complete wrong terms here, because I'm only used to doing this with a specific language, but here's what I want to do: python mytest.py: if(registry.taskid==valid_

Re: [Tutor] is this doable

2019-05-31 Thread Alan Gauld via Tutor
On 31/05/2019 20:41, nathan tech wrote: > Is it possible, in python, to store a running task id in the registry? >From mention of the registry I assume you are running Windows? There is no registry on Unixlike systems. The answer in either case is yes since a task ID is just a number. However if

Re: [Tutor] is this doable

2019-05-31 Thread Mats Wichmann
On 5/31/19 1:41 PM, nathan tech wrote: > Hi there, > > So for a future project of mine, I was wondering something. > > Is it possible, in python, to store a running task id in the registry? > > I might be using the complete wrong terms here, because I'm only used to > doing this with a specific

[Tutor] Interactive editing of variables.

2019-05-31 Thread mhysnm1964
Hello all, Python 3.7, windows 10. I have no clue on how to achieve what I want to do and the code I have creates an hash. As shown below: for row in description: text = description_rejex(row) # applies a regular expression test function to remove text. Returns a list. if text

Re: [Tutor] Interactive editing of variables.

2019-05-31 Thread Cameron Simpson
On 01Jun2019 12:53, Sean Murphy wrote: Python 3.7, windows 10. I have no clue on how to achieve what I want to do and the code I have creates an hash. As shown below: for row in description: [... get some text and present it for editing ...] I have had a look and cannot find an example where

Re: [Tutor] Interactive editing of variables.

2019-05-31 Thread Alan Gauld via Tutor
On 01/06/2019 03:53, mhysnm1...@gmail.com wrote: > I have no clue on how to achieve what I want to do and the code I have > creates an hash. As shown below: Thats because what you want is not a standard feature of CLI apps. You will need to do one of the following(in order of easiness): 1) Use a

Re: [Tutor] is this doable

2019-05-31 Thread Alan Gauld via Tutor
On 01/06/2019 00:13, Alan Gauld via Tutor wrote: > Is the language C/C++? If so you may know the OS API calls needed > and you could access those directly from Python using ctypes > That might make your job more familiar and easier. I meant to add a nod to Mark Hammond's win32 package too. It