post are valuable insights. I have made a
gnote of it!
\d
Here is a link to a page that explains unicode and encodings in a way
that made me think I understand some of it:
http://www.joelonsoftware.com/articles/Unicode.html
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
fundamentally silly by having them walk over the same list
simultaneously?
For one time sequences like files and generators your code is broken
for obvious reasons.
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
appeared in python 2.6. Perhaps there
is some __future__ stuff you can import to get it to work, don't know.
If not you are stuck with the old string formatting until you upgrade
to 2.6 or newer:
print u'Hello %s!' % u'world'
Hello world!
/Niklas Norrthon
--
http://mail.python.org/mailman
On 8 Sep, 05:39, Steven D'Aprano
ste...@remove.this.cybersource.com.au wrote:
On Mon, 07 Sep 2009 01:54:09 -0700, Niklas Norrthon wrote:
Others have answered how to replace '\\n' with '\n'. For a more general
approach which will handle all string escape sequences allowed in python
\tAnd\tgood\040\x47ood bye!
print eval('str(%s)' % unquoted_string)
hello
world! And good Good bye!
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
On 6 Sep, 09:00, Maggie la.f...@gmail.com wrote:
code practice:
test = open (test.txt, r)
readData = test.readlines()
#set up a sum
sum = 0;
for item in readData:
sum += int(item)
print sum
test file looks something like this:
34
23
124
432
12
sum(map(int,
it:
r'test \'
SyntaxError: EOL while scanning string literal
r'test \\'
'test '
Second one is accepted. See the language reference section 2.4.1 as of
why;
http://www.python.org/doc/current/reference/lexical_analysis.html?highlight=raw%20strings#string-literals
/Niklas Norrthon
--
http
better?
Clearly, any comparison with a boolean literal should be illegal. ;)
So you think
truth_value = True
if test.find(item) == truth_value: ...
would have been better? :-)
(couldn't resist...)
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
:] = ['arg1', 'arg2', 'arg3']
import whatever
whatever.main()
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
easily be achieved with the or operator as Michiel
Overton notes elsewhere in this thread:
def some_function(arg, coll=None):
do_stuff(arg)
for item in coll or []: # = Here or is used to make None behave
as an empty collection
do_more(arg, item)
/Niklas Norrthon
--
http
On 26 Mar, 08:18, Niklas Norrthon niklas.norrt...@hotmail.com wrote:
But that can easily be achieved with the or operator as Michiel
Overton notes elsewhere in this thread:
Michiel Overtoom was what I meant to write. My apologies!
def some_function(arg, coll=None):
do_stuff(arg
with python 2.4, to ensure
that they run in ArcGIS 9.2 environments.
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
I would choose. Faster hardware can only go so far in hiding
the effect of poor algorithms.
I agree 100%
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
._fileobject object at
0x00BF4030
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
On 23 Juli, 17:33, antar2 [EMAIL PROTECTED] wrote:
I already asked a similar question, but encounter problems with
python...
How can I concatenate the elements in each list of a list of lists
list_of_listsA =
[['klas*', '*', '*'],
['mooi*', '*', '*', '*'],
['arm*', '*', '*(haar)']]
On 24 Juli, 00:30, Samir [EMAIL PROTECTED] wrote:
from math import sqrt
def findSumOfDivisor(n):
[...]
return sum(divisor) # return the sum of the
divisors
for i in range(2,10): # loop through integers 2
through 9
[...]
sum = findSumOfDivisor(i)
On 6 Juni, 03:09, Russ P. [EMAIL PROTECTED] wrote:
On Jun 5, 2:57 pm, Hrvoje Niksic [EMAIL PROTECTED] wrote:
Russ P. [EMAIL PROTECTED] writes:
By the way, my recollection is that in C++ access defaults to private
if nothing is declared explicity. So normally the private
declaration is
better (unless you hate emacs).
--
Niklas Norrthon
ESRI S-GROUP
--
http://mail.python.org/mailman/listinfo/python-list
this is called cross posting.
/Niklas Norrthon
--
http://mail.python.org/mailman/listinfo/python-list
19 matches
Mail list logo