Re: Spurious issue in CPython 2.7.5

2016-05-24 Thread Novocastrian_Nomad
On Tuesday, May 24, 2016 at 5:47:55 AM UTC-6, thomas povtal.org wrote:
...
>1: I get "RuntimeWarning: tp_compare didn't return -1 or -2 for
>exception". It's a line like:
> 
>"if Foo = False:" where Foo is a global variable (global Foo).
...

Are you really using "if Foo = False:"?
If so, it should be "if Foo == False:"
"==" for equivalence rather than "=" for assignment.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: webware for python 3

2015-04-06 Thread Novocastrian_Nomad
On Monday, April 6, 2015 at 11:26:15 PM UTC-6, rah...@gmail.com wrote:
 I have an old project which uses web ware, where i want to convert to latest 
 version 3.4
 
 I am wondering whether any webware is available for python version 3.4. What 
 I am seeing is the webware version 1.1.1 which is old and seems like it is 
 not supporting the version 3.4 as I could see the print is written print abc 
 and no braces.
 
 So how should i approach converting this project which is based on python 
 2.2.1 ?

Some or all of what you need may already be done.  See 
http://pythonpaste.org/wareweb/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How can i use a dictionnary

2015-01-13 Thread Novocastrian_Nomad
On Tuesday, January 13, 2015 at 2:03:30 AM UTC-7, brice DORA wrote:
 i consume a web service that return a element whose the type is instance. 
 but this element seem be a dictionary but when i want to use it like a 
 dictionary, i got some errors. so this is the element and please someone can 
 tell me how can i use it. tkanks in advance.
 
 
 (tCountryInfo){
sISOCode = CI
sName = Côte D'Ivoire (Ivory Coast)
sCapitalCity = Yamoussoukro
sPhoneCode = 225
sContinentCode = AF
sCurrencyISOCode = XOF
sCountryFlag = 
 http://www.oorsprong.org/WebSamples.CountryInfo/Images/Côte D'Ivoire.jpg
Languages = 
   (ArrayOftLanguage){
  tLanguage[] = 
 (tLanguage){
sISOCode = fr
sName = French
 },
   }
  }

This data is not a Python dictionary, nor is it a JSON object.  You will 
probably need to code your own conversion function to make it a Python 
dictionary.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Working with HTML5 documents

2014-11-19 Thread Novocastrian_Nomad
On Wednesday, November 19, 2014 2:08:27 PM UTC-7, Denis McMahon wrote:
 So what I'm looking for is a method to create an html5 document using dom 
 manipulation, ie:
 
 doc = new htmldocument(doctype=HTML)
 html = new html5element(html)
 doc.appendChild(html)
 head = new html5element(body)
 html.appendChild(head)
 body = new html5element(body)
 html.appendChild(body)
 title = new html5element(title)
 txt = new textnode(This Is The Title)
 title.appendChild(txt)
 head.appendChild(title)
 para = new html5element(p)
 txt = new textnode(This is some text.)
 para.appendChild(txt)
 body.appendChild(para)
 
 print(doc.serialise())
 
 generates:
 
 !doctype HTMLhtmlheadtitleThis Is The Title/title/
 headbodypThis is some text./p/body/html
 
 I'm finding various mechanisms to generate the structure from an existing 
 piece of html (eg html5lib, beautifulsoup etc) but I can't seem to find 
 any mechanism to generate, manipulate and produce html5 documents using 
 this dom manipulation approach. Where should I be looking?
 
 -- 
 Denis McMahon,

Use a search engine (Google, DuckDuckGo etc) and search for 'python write html'
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Martijn Faassen: The Call of Python 2.8

2014-04-15 Thread Novocastrian_Nomad
On Tuesday, April 15, 2014 12:32:14 PM UTC-6, Mark H. Harris wrote:
 On 4/14/14 2:32 PM, Phil Dobbin wrote:
  On a related note, Guido announced today that there will be no 2.8 
  that the eol for 2.7 will be 2020.
 

 Can you site the announcement?
 
 Thanks

http://hg.python.org/peps/rev/76d43e52d978?utm_content=buffer55d59utm_medium=socialutm_source=facebook.comutm_campaign=buffer
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Find and Replace Simplification

2013-07-19 Thread Novocastrian_Nomad
On Friday, July 19, 2013 7:22:48 AM UTC-6, Devyn Collier Johnson wrote:
 I have some code that I want to simplify. I know that a for-loop would 
 
 work well, but can I make re.sub perform all of the below tasks at once, 
 or can I write this in a way that is more efficient than using a for-loop?
 
 DATA = re.sub(',', '', 'DATA')
 DATA = re.sub('\'', '', 'DATA')
 DATA = re.sub('(', '', 'DATA')
 DATA = re.sub(')', '', 'DATA')


Try DATA = re.sub(r'[(,\\)]', '', 'DATA')

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Rant on web browsers

2011-06-14 Thread Novocastrian_Nomad
CoffeeScript maybe? http://jashkenas.github.com/coffee-script
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: rstrip()

2010-07-16 Thread Novocastrian_Nomad
On Jul 16, 10:58 am, Jason Friedman ja...@powerpull.net wrote:
 $ python
 Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
 [GCC 4.4.1] on linux2
 Type help, copyright, credits or license for more information.
 x.vsd-dir.rstrip(-dir)

 'x.vs'

 I expected 'x.vsd' as a return value.

One way to achieve the desired result:
'x.vsd-dir'.split('-')[0]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Need direction on mass find/replacement in HTML files

2010-05-01 Thread Novocastrian_Nomad
One single line regex solution would be:

re.sub(r'http\://www.mysite.org/\?page=([^]+)',r'pages/\1.htm',html)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Use Regular Expressions to extract URL's

2010-04-30 Thread Novocastrian_Nomad
Or perhaps more generically:

 import re

 string = 'scatter http://.yahoo.com quotes and text anywhere 
 www.google.com www.bing.com or not'

 print re.findall(r'(?:http://|www.)[^\s]+',string)

['http://.yahoo.com', 'www.google.com', 'www.bing.com']
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Best Way to extract Numbers from String

2010-03-20 Thread Novocastrian_Nomad
Regular expression are very powerful, and I use them  a lot in my
paying job (unfortunately not with Python).  You are however,
basically using a second programing language, which can be difficult
to master.

Does this give you the desired result?

import re

matches = re.findall('td([\d\.,]+)\s*/td', code)
for match in matches:
print match

resulting in this output:
43.150
43.200
43.130
43.290
43.100
7,450,447
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Author of a Python Success Story Needs a Job!

2010-01-14 Thread Novocastrian_Nomad
Why is it so many, so called high tech companies, insist on the 19th
century practice of demanding an employee's physical presence in a
specific geographic location.

This is the 21st century with climate change, carbon footprints,
broadband internet, telecommuting, tele-presence, telephones, fax
machines, mobile phones, electronic funds transfer, express shipping
companies and a host of other gadgets and applications, that make
geographic location almost irrelevant.

I know whereof I speak, I have been fortunate enough to work remotely
(across the country) for the last ten years, for two different
employers.

(possibly OT rant over)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Query about doing fortran-esque repeat formatting

2009-11-08 Thread Novocastrian_Nomad
How about:

print ('%s ' + '%-5.4f ' * 7) % ('text',1,2,3,4,5,6,7)

-- 
http://mail.python.org/mailman/listinfo/python-list