Re: [Tutor] Why does print(a_list.sort()) return None?

2015-03-29 Thread Alan Gauld
On 29/03/15 07:00, Cameron Simpson wrote: print(a_list.sort()) is printing the result of "a_list.sort()". Like most Python functions that operate on something (i.e. .sort, which sorts the list in place), the .sort method returns None. And that is printed. But you can use the sorted() funct

Re: [Tutor] escape character regex

2015-03-29 Thread Ian D
Ha ha thanks Danny for the hex message! I am looking to basically match 2 unknown hex values or a byte at the end of the 4 byte sequence. I realise now I am trying to use a numeric \d expression when it needs to be matching 2 nibbles or a byte. Is there a way to match using some sort of wil

Re: [Tutor] Python OO

2015-03-29 Thread Alan Gauld
On 29/03/15 02:16, Juan C. wrote: Ok, so, let me try to express what I think is 'right' here according to what you said. My code structure needs to be something like that: pycinema - package: pycinema - - __init__.py - - api.py - - actor.py - - movie.py - - serie.py - __main__.py What I said

Re: [Tutor] escape character regex

2015-03-29 Thread Ian D
Ok I got it. pchars = re.compile(b'\x00\x00\x00[\0-\xff]') preceeding b and [0-\xff] > From: dux...@hotmail.com > To: tutor@python.org > Date: Sun, 29 Mar 2015 07:55:01 + > Subject: Re: [Tutor] escape character regex > > Ha ha thanks Danny for th

Re: [Tutor] escape character regex

2015-03-29 Thread Peter Otten
Ian D wrote: > Ok I got it. > > pchars = re.compile(b'\x00\x00\x00[\0-\xff]') > > preceeding b and [0-\xff] Also possible: re.compile(b"\0\0\0.", re.DOTALL) . by default means "any byte except \n", the re.DOTALL flag changes that to "any byte". or re.compile(b"\0{3}.", re.DOTALL) {3} mean

Re: [Tutor] Python OO

2015-03-29 Thread Dave Angel
On 03/28/2015 09:16 PM, Juan C. wrote: Ok, so, let me try to express what I think is 'right' here according to what you said. My code structure needs to be something like that: pycinema - package: pycinema - - __init__.py - - api.py - - actor.py - - movie.py - - serie.py - __main__.py I'd su

Re: [Tutor] Python OO

2015-03-29 Thread Mark Lawrence
On 29/03/2015 02:32, Juan C. wrote: On Sat, Mar 28, 2015 at 10:26 PM Mark Lawrence wrote: If your classes are small put them in one source file, which is clearly simpler than your proposed structure. Why over-engineer something if there is no need to? Well, my classes won't be that small, and s

Re: [Tutor] Python OO

2015-03-29 Thread Peter Otten
Dave Angel wrote: > On 03/28/2015 09:16 PM, Juan C. wrote: >> Ok, so, let me try to express what I think is 'right' here according to >> what you said. >> >> My code structure needs to be something like that: >> >> pycinema >> - package: pycinema >> - - __init__.py >> - - api.py >> - - actor.py >>

Re: [Tutor] Why does print(a_list.sort()) return None?

2015-03-29 Thread boB Stepp
On Sun, Mar 29, 2015 at 2:53 AM, Alan Gauld wrote: > On 29/03/15 07:00, Cameron Simpson wrote: > >> print(a_list.sort()) >> >> is printing the result of "a_list.sort()". >> >> Like most Python functions that operate on something (i.e. .sort, which >> sorts the list in place), the .sort method re

Re: [Tutor] Why does print(a_list.sort()) return None?

2015-03-29 Thread Mark Lawrence
On 29/03/2015 16:25, boB Stepp wrote: On Sun, Mar 29, 2015 at 2:53 AM, Alan Gauld wrote: On 29/03/15 07:00, Cameron Simpson wrote: print(a_list.sort()) is printing the result of "a_list.sort()". Like most Python functions that operate on something (i.e. .sort, which sorts the list in pla

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
On Sun, Mar 29, 2015 at 3:56 AM Ben Finney wrote: As a side issue: You apparently intend to choose names that are English language. If that's true, you should know that “actor”, “movie”, “series” are all singular. My bad, it's series indeed. On Sun, Mar 29, 2015 at 10:33 AM Dave Angel wrote:

Re: [Tutor] Python OO

2015-03-29 Thread Mark Lawrence
On 29/03/2015 18:30, Juan C. wrote: On Sun, Mar 29, 2015 at 3:56 AM Ben Finney wrote: As a side issue: You apparently intend to choose names that are English language. If that's true, you should know that “actor”, “movie”, “series” are all singular. My bad, it's series indeed. On Sun, Mar 29

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
Ok, applying what you guys said I have: - folder: pycinema - package: pycinema - - core.py - - mdb.py - __main__.py Current code on core.py: # -*- coding: utf-8 -*- from pycinema.mdb import MovieDB API = MovieDB('API KEY GOES HERE') class Actor: def __init__(self, actor_id): api = API.get_act

Re: [Tutor] Python OO

2015-03-29 Thread Alan Gauld
On 29/03/15 20:16, Juan C. wrote: Current code on core.py: from pycinema.mdb import MovieDB API = MovieDB('API KEY GOES HERE') class Actor: ... Current code on mdb.py: import requests class MovieDB: ... def get_actor(self, actor_id): response = requests.get('http://api.themoviedb.org/3/per

[Tutor] Advice on Strategy for Attacking IO Program

2015-03-29 Thread Saran Ahluwalia
Hello: Here is what I am trying have my program do: • Monitor a folder for files that are dropped throughout the day • When a file is dropped in the folder the program should scan the file o IF all the contents in the file have the same length o THEN the file should be moved to a "success" fo

[Tutor] Functions not changing

2015-03-29 Thread Calvin Thai
I'm currently making a pygame using IDLE and i'm having a minor issue with my functions not changing color. My text is all plain black and its bothering me. Is there a solution or can i make my program using another text editor? (I tried using notepad++ but i don't know how to run the program, it o

[Tutor] What is wrong with my code?

2015-03-29 Thread Antonia van der Leeuw
Hehey! I'm learning python on a website called codecademy.com, where I made a program to decode binary numbers. I guess the site uses a different compiler, because on the site my code worked fine, but when I copied and pasted it into the Python IDLE (3.4.2) it didn't work! I'm really don't know wh

Re: [Tutor] Functions not changing

2015-03-29 Thread Calvin Thai
Found the solution On Sun, Mar 29, 2015 at 2:56 PM, Calvin Thai wrote: > I'm currently making a pygame using IDLE and i'm having a minor issue with > my functions not changing color. My text is all plain black and its > bothering me. Is there a solution or can i make my program using another > t

[Tutor] lamda in list comp

2015-03-29 Thread Jim Mooney
Shouldn't this give me a list of squares? [lambda x: x**2 for x in range(10)] Instead I'm getting ten of these (with different addresses) . at 0x01262A50>] -- Jim I can't think of a clever tagline today, so just imagine I said something clever. ___ Tu

[Tutor] Feedback on Script for Pandas DataFrame Written into XML

2015-03-29 Thread Saran Ahluwalia
Hello: I would appreciate your feedback on whether I correctly wrote my XML. I am exporting a DataFrame and writing into a XML file. I used the ElementTree library. The DataFrame has 11 rows and 8 columns (excluding the index column). #My schema assumption: # #[ #Some number row #Sample text #]

[Tutor] Starting the IDLE

2015-03-29 Thread Troll Worfolk
 I downloaded Python 3.4.3 today (twice) and I can't get the IDLE to start.  The Python in the command window works great but I can't figure how to start the IDLE.  When I installed python there are two icons,  'PYTHON'  and "PYTHONW" . The first will opens Python in a command window and all is

[Tutor] if statement help

2015-03-29 Thread Priya Persaud
Hello, I recently learned about if statements and math functions. For my class we are unit testing absolute values and have to make if statements so the tests pass, but we cannot use built in functions like (abs). How do I start it, I am so lost. Thank you

[Tutor] script

2015-03-29 Thread George Bollen
hi, i am new to python and i have not done programming before but i am learning along the way, just want you to help me on how i can write a script that accepts an input a measurement of a time interval in seconds and prints a sentence giving the equivalent of the given number of seconds in hours,

Re: [Tutor] lamda in list comp

2015-03-29 Thread Mark Lawrence
On 29/03/2015 02:25, Jim Mooney wrote: Shouldn't this give me a list of squares? [lambda x: x**2 for x in range(10)] Instead I'm getting ten of these (with different addresses) . at 0x01262A50>] That's exactly what you've asked the code to do. What makes you think you need a lambda function

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
On Sun, Mar 29, 2015 at 8:55 PM Alan Gauld wrote: Can you explain how that works? Does the user create their own random unique values? Do you use a source of unique keys? Or could the Actor init() maybe generate an ID for the user? But without the API knowing the ID, how does the correct data get

Re: [Tutor] lamda in list comp

2015-03-29 Thread Danny Yoo
On Sat, Mar 28, 2015 at 6:25 PM, Jim Mooney wrote: > Shouldn't this give me a list of squares? > [lambda x: x**2 for x in range(10)] > > Instead I'm getting ten of these (with different addresses) > . at 0x01262A50>] Mark Lawrence's answer shows how to correct this. Let's look at the problem a

Re: [Tutor] What is wrong with my code?

2015-03-29 Thread Danny Yoo
On Fri, Jan 23, 2015 at 1:40 PM, Antonia van der Leeuw wrote: > Hehey! > > I'm learning python on a website called codecademy.com, where I made a > program to decode binary numbers. I guess the site uses a different > compiler, because on the site my code worked fine, but when I copied and > paste

Re: [Tutor] script

2015-03-29 Thread Danny Yoo
On Sat, Mar 28, 2015 at 4:04 PM, George Bollen wrote: > hi, i am new to python and i have not done programming before but i am > learning along the way, > > just want you to help me on how i can write a script that accepts an input > a measurement of a time interval in > seconds and prints a sente

Re: [Tutor] if statement help

2015-03-29 Thread Danny Yoo
On Thu, Mar 26, 2015 at 5:42 PM, Priya Persaud wrote: > Hello, > > I recently learned about if statements and math functions. For my class we > are unit testing absolute values and have to make if statements so the > tests pass, but we cannot use built in functions like (abs). How do I start > it,

Re: [Tutor] What is wrong with my code?

2015-03-29 Thread Ben Finney
Danny Yoo writes: > Python 3 is a different language than Python 2. It looks like the > codeacademy materials use Python 2, so you should probably do the same > on your local system. Alternatively, learn Python 3 (which at this time means learning somewhere other than Codecademy). https://w

Re: [Tutor] Starting the IDLE

2015-03-29 Thread Danny Yoo
On Thu, Mar 26, 2015 at 12:55 PM, Troll Worfolk wrote: > I downloaded Python 3.4.3 today (twice) and I can't get the IDLE to start. Did you run the installer afterwards? What menu items do you see in your Windows "Start Menu" that are associated to "Python 3.4"?

[Tutor] trying to convert pycurl/html to ascii

2015-03-29 Thread bruce
Hi. Doing a quick/basic pycurl test on a site and trying to convert the returned page to pure ascii. The page has the encoding line The test uses pycurl, and the StringIO to fetch the page into a str. pycurl stuff . . . foo=gg.getBuffer() -at this point, foo has the page in a str buffer. W

Re: [Tutor] Python OO

2015-03-29 Thread Juan C.
On Sun, Mar 29, 2015 at 9:39 PM Juan C. wrote: The ID is set by the API, I don't have control over it, I can't modify it, and I don't really need to modify it. There is an option to search the API using the name, like so ( http://private-anon-37abaab74-themoviedb.apiary-mock.com/3/search/person?qu

Re: [Tutor] What is wrong with my code?

2015-03-29 Thread Dave Angel
On 01/23/2015 04:40 PM, Antonia van der Leeuw wrote: Hehey! I'm learning python on a website called codecademy.com, where I made a program to decode binary numbers. I guess the site uses a different compiler, because on the site my code worked fine, but when I copied and pasted it into the Pytho

Re: [Tutor] trying to convert pycurl/html to ascii

2015-03-29 Thread Dave Angel
On 03/29/2015 09:49 PM, bruce wrote: Hi. Doing a quick/basic pycurl test on a site and trying to convert the returned page to pure ascii. You cannot convert it to pure ASCII. You could replace all the invalid characters with some special one, like question marks. But I doubt if that's what

Re: [Tutor] trying to convert pycurl/html to ascii

2015-03-29 Thread Cameron Simpson
On 29Mar2015 21:49, bruce wrote: Doing a quick/basic pycurl test on a site and trying to convert the returned page to pure ascii. And if the page cannot be representing in ASCII? The page has the encoding line The test uses pycurl, and the StringIO to fetch the page into a str. Which Stri

Re: [Tutor] Advice on Strategy for Attacking IO Program

2015-03-29 Thread Martin A. Brown
Greetings, Here is what I am trying have my program do: • Monitor a folder for files that are dropped throughout the day • When a file is dropped in the folder the program should scan the file o IF all the contents in the file have the same length o THEN the file should be moved to a "succe

Re: [Tutor] Feedback on Script for Pandas DataFrame Written into XML

2015-03-29 Thread Martin A. Brown
Good evening again, I'm replying to your second post, because I replied to the first. This may be a more specific request than is typically handled on Python tutor. This involves specific knowledge of the xml.etree.ElementTree and pandas.DataFrame objects. I would appreciate your feedback