"Oleg Oltar" wrote
I am trying to decode a string I took from file:
file = open ("./Downloads/lamp-post.csv", 'r')
I assume you know what its supposed to represent?
What the columns etc are intended to be?
Otherwise it will be a challenge!
There is a section here that looks like the mon
Oleg Oltar wrote:
Hi,
I am trying to decode a string I took from file:
[...]
How do I convert this to something human readable?
In general, you can't unless you know the encoding. A file filled with
arbitrary bytes could be anything.
However, you can sometimes guess the encoding, either b
Oleg Oltar wrote:
> I am trying to decode a string I took from file:
>
> file = open ("./Downloads/lamp-post.csv", 'r')
> data = file.readlines()
> data[0]
>
>
'\xff\xfeK\x00e\x00y\x00w\x00o\x00r\x00d\x00\t\x00C\x00o\x00m\x00p\x00e\x00t\x00i\x00t\x00i\x00o\x00n\x00\t\x00G\x00l\x00o\x00b\x00a\x0
Hi,
I am trying to decode a string I took from file:
file = open ("./Downloads/lamp-post.csv", 'r')
data = file.readlines()
data[0]
'\xff\xfeK\x00e\x00y\x00w\x00o\x00r\x00d\x00\t\x00C\x00o\x00m\x00p\x00e\x00t\x00i\x00t\x00i\x00o\x00n\x00\t\x00G\x00l\x00o\x00b\x00a\x00l\x00
\x00M\x00o\x00n\x00t\x
On Thu, Apr 1, 2010 at 5:47 PM, wrote:
> Hi, all;
>
> I am a longtime linux sysadmin that is fairly new to Python. I've got a
> project for which Python seems to be perfect (or, at least, I've found a
> way to integrate my learning :-)
Welcome to Python! I highly recommend this book by Noah G
Hi, all;
I am a longtime linux sysadmin that is fairly new to Python. I've got a
project for which Python seems to be perfect (or, at least, I've found a
way to integrate my learning :-)
I receive log files via email from an outside vendor. We use Splunk to
generate reports based on these and
bhaaluu wrote:
> Greetings,
>
>>From what I can tell of this "decoding" function, it uses
> the chr() function to return the ascii character:
>
print chr(eval('65'))
> A
There is no need to use eval() here. Since the expected values are
integers, just use int():
In [6]: chr(int('65'))
Out[
--- bhaaluu <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> From what I can tell of this "decoding" function, it
> uses
> the chr() function to return the ascii character:
>
> >>> print chr(eval('65'))
> A
>
> >>> print ord('A')
> 65
>
> In this textbook example, the "code" is simple a
> string o
--- bhaaluu <[EMAIL PROTECTED]> wrote:
> Greetings,
>
> From what I can tell of this "decoding" function, it
> uses
> the chr() function to return the ascii character:
>
> >>> print chr(eval('65'))
> A
>
> >>> print ord('A')
> 65
>
> In this textbook example, the "code" is simple a
> string of
Eric Walker wrote:
> newbie here,
>
Welcome
> I just tried playing around with the dec function and
> I get errors.
Please always post the traceback (error message), and the code you are
using.
> Correct me if I am wrong. After getting
> the input,
What input is dec() expecting? As I read it
Greetings,
>From what I can tell of this "decoding" function, it uses
the chr() function to return the ascii character:
>>> print chr(eval('65'))
A
>>> print ord('A')
65
In this textbook example, the "code" is simple a string of the
ASCII characters' numeric values. Nothing fancy.
What does th
newbie here,
I just tried playing around with the dec function and
I get errors. Correct me if I am wrong. After getting
the input, the string.split will parse the string
across whitespace chars so in other words you get a
list of each word entered. Then when it does the
eval(x) part it dies. I tri
Thanks, it really works.
On 8/13/07, bhaaluu <[EMAIL PROTECTED]> wrote:
>
> Greetings,
>
> Disclaimer: I'm a Python Noob,
> so use the code snippets
> in this post, at your own risk!
>
> Is this what you're looking for?
>
> def dec(a):
> import string
> result=''
> for x in string.spl
At 02:12 PM 8/12/2007, Dick Moores wrote:
At 01:15 PM 8/12/2007, Khamid
Nurdiev wrote:
Hello All,
I am currently learning python with the book "Python
programming: An introduction to CS" by John M. Zelle and have come
the section where he speaks of encoding messages. Currently the basic
snippet
At 01:15 PM 8/12/2007, Khamid Nurdiev wrote:
Hello All,
I am currently learning python with the book "Python
programming: An introduction to CS" by John M. Zelle and have come
the section where he speaks of encoding messages. Currently the basic
snippet looks like this:
def dec():
import
Greetings,
Disclaimer: I'm a Python Noob,
so use the code snippets
in this post, at your own risk!
Is this what you're looking for?
def dec(a):
import string
result=''
for x in string.split(a):
result=result+chr(eval(x))
return result
print dec(raw_input("Enter the messa
Hello All,
I am currently learning python with the book "Python programming: An
introduction to CS" by John M. Zelle and have come the section where he
speaks of encoding messages. Currently the basic snippet looks like this:
def dec():
> > import string
> > message=raw_input("Enter the m
Johan Geldenhuys wrote:
> I receive this error when executing a file:
> "Non-ASCII character '\x8b' in file task.py on line 1, but no encoding
> declared".
>
> Can anybody tell me what the encoding is supposed to look like and is it
> standard on all files that is trying to use Non-ASCII charact
I receive this error when executing a file:
"Non-ASCII character '\x8b' in file task.py on line 1, but no encoding
declared".
Can anybody tell me what the encoding is supposed to look like and is it
standard on all files that is trying to use Non-ASCII characters?
Thanks,
Johan
19 matches
Mail list logo