[Tutor] Calendar Module
Hello, I just got Python In a Nutshell and decided to play around with the time section. While playing with the calendar module, I encountered a problem:>>> import calendar>>> calendar.calendar (2006)' 2006\n\n January February March\nMo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n 1 1 2 3 4 5 1 2 3 4 5\n 2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12\n 9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19\n16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26\n23 24 25 26 27 28 29 27 28 27 28 29 30 31\n30 31\n\n April May June\nMo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n 1 2 1 2 3 4 5 6 7 1 2 3 4\n 3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11\n10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18\n17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25\n24 25 26 27 28 29 30 29 30 31 26 27 28 29 30\n\n July August September\nMo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n 1 2 1 2 3 4 5 6 1 2 3\n 3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10\n10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17\n17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24\n24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30\n31\n\n October November December\nMo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su\n 1 1 2 3 4 5 1 2 3\n 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10\n 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17\n16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24\n23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n30 31\n' >>> I can't seem to figure out how to make it look prettierThanks in advanceMarshall Jiang-- Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Rick Cook, The Wizardry Compiled ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Question about formating string with dictionary
Hello everyone, The program that I am working on right now have a template for string formatting. My question is that is it possible to use multiple dictionary to format the string. For example x = {'foo':1234, 'bar': 5678} y = {'spam':'hello','cheese':'good-bye'} is there any way to use his pseudo code template = \ """Foo = %(foo)s bar = %(bar)s spame = %(spam)s cheese = %(cheese)s""" print template %x,y Thanks Marshall -- I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Convert .pyc to .py
Hello, I was playing with pyInstaller and I moved the file to the directory. After I finished playing with it, I accidentally deleted it (I bypassed the recycle bin). Now I lost my project files and my file restoration didn't find it, but I still have the .pyc file though. I'm wondering weather I can convert the .pyc back to .py. I tried pyc2py but it came out with some weird stuff. Please help! Thanks Marshall -- I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Convert .pyc to .py
Is there no opensource (free) version? I'm a kid and I don't have a credit card or bank account. On 5/5/07, Andreas Kostyrka <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Check out http://www.crazy-compilers.com/decompyle/service.html > > Andreas > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.4.2 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iD8DBQFGPQzOHJdudm4KnO0RAvMhAKDrXe6U+2tZBqfrfI/eKa36RB1VKgCePExI > +2mxXCw0bNeL6PetA4i1KcU= > =hcz6 > -END PGP SIGNATURE- > -- I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Python and displaying mathematical equations?
Hello, I'm trying to create an application that retrieves and displays (probably in HTML or PDF format) math problems from a database. The problem is that I need some sort of mechanism to display mathematical equations. I'm trying to not use Latex as it would cause the users to install Latex (and most likely dvipng) on their own computers. Is there a lighter version of Latex for Python or do I have to just use Latex? Thanks! Marshall Jiang -- Visit my blog at runiteking1.blogspot.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Python and displaying mathematical equations?
Never even knew about MathML... stupid me. My Firefox browser can't handle the MathML test page quite well, can't show the root sign. Thank you very much! On Mon, Mar 3, 2008 at 9:15 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > On 04/03/2008, Shuai Jiang (Runiteking1) <[EMAIL PROTECTED]> wrote: > > Hello, I'm trying to create an application that retrieves and displays > > (probably in HTML or PDF format) math problems from a database. > > The problem is that I need some sort of mechanism to display > mathematical > > equations. > > If you can describe your equations in MathML then there may be options > for you -- a quick google for "python mathml" turned up a few hits -- > e.g. http://sourceforge.net/projects/pymathml/ or > http://www.grigoriev.ru/svgmath/ (if you accept SVG as an output). > > -- > John. > -- Visit my blog at runiteking1.blogspot.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Question regarding parsing HTML with BeautifulSoup
Hello, I'm working on a program that need to parse a financial document on the internet using BeautifulSoup. Because of the nature of the information, it is all grouped as a table. I needed to get 3 types of info and have succeeded quite well using BeautifulSoup, but encountered problems on the third one. My question is that is there any easy way to parse an HTML tables column easily using BeautifulSoup. I copied the table here and I need to extract the EPS. The numbers are every sixth one from the tag ex 2.27, 1.86, 1.61... Thanks! Marshall Sales EBIT Depreciation Total Net Income EPS Tax Rate (%) 02/06 30,848.0 1,721.0 456.0 1,140.0 2.27 33.76 02/05 27,433.0 1,443.0 459.0 934.0 1.86 35.27 02/04 24,548.0 1,296.0 385.0 800.0 1.61 38.27 03/03 20,943.0 1,014.0 310.0 622.0 1.27 38.66 03/02 17,711.0 926.0 245.0 570.0 1.18 38.44 03/01 15,189.0 649.0 165.0 401.0 0.84 38.21 02/00 12,494.02 562.57 109.54 347.07 0.73 38.31 02/99 10,064.65 351.68 73.63 216.28 0.46 38.5 02/98 8,337.76 133.4 71.58 81.94 0.2 38.58 03/97 7,770.68 2.87 66.84 1.75 0.0 39.05 -- I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Question regarding parsing HTML with BeautifulSoup
Hi, Wow, thats much more elegant than the idea I thought of. Thank you very much Kent! Marshall On 1/3/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Shuai Jiang (Runiteking1) wrote: > Hello, > > I'm working on a program that need to parse a financial document on the > internet > using BeautifulSoup. Because of the nature of the information, it is all > grouped > as a table. I needed to get 3 types of info and have succeeded quite > well using > BeautifulSoup, but encountered problems on the third one. > > My question is that is there any easy way to parse an HTML tables column > easily using BeautifulSoup. I copied the table here and I need to > extract the EPS. The numbers are > every sixth one from the tag ex 2.27, 1.86, 1.61... Here is one way, found with a little experimenting at the command prompt: In [1]: data = ''' ...: ''' In [3]: from BeautifulSoup import BeautifulSoup as BS In [4]: soup=BS(data) In [11]: for tr in soup.table.findAll('tr'): : print tr.contents[11].string : : EPS 2.27 1.86 1.61 1.27 1.18 0.84 0.73 0.46 0.2 0.0 Kent -- I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] [Edu-sig] school physics/math courses
How about http://projecteuler.net/? From their website: > Project Euler is a series of challenging mathematical/computer programming > problems that will require more than just mathematical insights to solve. > Although mathematics will help you arrive at elegant and efficient methods, > the use of a computer and programming skills will be required to solve most > problems. > On Fri, Oct 17, 2008 at 5:19 AM, Edward Cherlin <[EMAIL PROTECTED]> wrote: > On Thu, Oct 16, 2008 at 4:15 AM, roberto <[EMAIL PROTECTED]> wrote: > > hello > > (i am rather new in python ...) > > Have you looked at NumPy and SciPy yet? Or anything written using them? > > > i am about to start a course of physics and math for students aged > > 14-17 (high school) > > and i am deeply interested in the possibilty of teaching fundamental > > concepts of these subjects via teaching programming; > > i chose python (i won't change my mind ...) > > > > so i am looking for resources on how to deal with these topics via > > this great programming language; > > > > i need some help from you and moreover if you are aware of books > > already covering these need > > > > thank you in advance > > -- > > roberto > > OS: GNU/Linux, Debian > > ___ > > Edu-sig mailing list > > [EMAIL PROTECTED] > > http://mail.python.org/mailman/listinfo/edu-sig > > > > > > -- > Don't panic.--HHGTTG, Douglas Adams > fivethirtyeight.com, 3bluedudes.com Obama still moving ahead in EC! > http://www.obamapedia.org/page/Smears Join us! > http://wiki.sugarlabs.org/go/User:Mokurai For the children > > Silent Thunder (默雷/धर्ममेघशब्दगर्ज ) is my name > And Children are my nation. > The Cosmos is my dwelling place, > The Truth my destination. > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > -- Visit my blog at runiteking1.blogspot.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor