On Monday, August 6, 2012 12:50:13 PM UTC-7, Mok-Kong Shen wrote:
> I ran the following code:
>
>
>
> def xx(nlist):
>
>print("begin: ",nlist)
>
>nlist+=[999]
>
>print("middle:",nlist)
>
>nlist=nlist[:-1]
>
>print("final: ",nlist)
>
>
>
> u=[1,2,3,4]
>
> print(u)
>
>>> p.sub('','a\nbc')
'abc'
>>> p.sub('','%s') % "a\nbc"
'a\nbc'
is it anyone got some idea why it happen?
--
http://mail.python.org/mailman/listinfo/python-list
thx for help :)
--
http://mail.python.org/mailman/listinfo/python-list
hi,all
if the html like:
if i use:
def handle_starttag(self, tag, attrs):
if tag == 'meta':
self.attr = attrs
self.headers += ['%s' % (self.attr)]
self.attr = ''
will get the output:
[('name', 'description'), ('content', 'a test page')]
[('name', 'keyw
hi,all, i try to replace every target word found in the text
for target in splitText:
if stopwords.find(target) >= 0 :
text = re.sub(r'\b%s\b','',text) &target
when i using the statment:
text = re.sub(r'\b%s\b','',text) &target
get error : unsupported operand type(s) for &
hi all..it a problem about dict:
print target, dict[target]
get output:
keyword
{page3.html, page2.html, page1.html}
is it some ways to change it to:
keyword
{page1.html, page2.html, page3.html}
--
http://mail.python.org/mailman/listinfo/python-list
hi all
a string like
"(word1 & (Word2|woRd3))"
how can i use the re to split it to
['word1', 'word2', 'word3']
--
http://mail.python.org/mailman/listinfo/python-list
im sorry, my engilsh is not vell well,
the string not only contain '&' and '|' and it can be anyting
i just want to split out the "whole word" inside the string
--
http://mail.python.org/mailman/listinfo/python-list
i try
query = query.lower()
print re.split(r'\W+',theString)
the reslut is :
['', 'word1', 'word2', 'word3', '']
how can i fix the statment to get
['word1', 'word2', 'word3']
--
http://mail.python.org/mailman/listinfo/python-list
i try
theString= theString.lower()
print re.split(r'\W+',theString)
the reslut is :
['', 'word1', 'word2', 'word3', '']
how can i fix the statment to get
['word1', 'word2', 'word3']
--
http://mail.python.org/mailman/listinfo/python-list
thx for help..i got it now :)
--
http://mail.python.org/mailman/listinfo/python-list
Hi all,
In a py file, when to use import statements in the header, when to use
import statements in the blocks where they are used?
What are the best practices?
Thanks!
Pat
--
http://mail.python.org/mailman/listinfo/python-list
Yes, I'm using this document now but I was wondering if there is a formal spec
for lexical grammar? It looks like some part of the doc
"http://docs.python.org/py3k/reference/grammar.html"; is missing.
We can find some replacement in lexical_analysis.html but it seems this
document is write fo
Hi guys,
This may be a cygwin issue but I was hoping to get some answers here
as well if someone has fixed this problem before.
Basically, I am able to run "python .py" python files in
command prompt. Unfortunately, I can't seem to get it to work in
cygwin. I always get an error that says:
pyth
Hi,
I am attempting to convert a bunch of .txt files into html using the
docutils package.
It works for most of the txt files except for the index.txt file which
gives 2 errors:
(1) Unknown Directive type "toctree"
(2) (ERROR/3) Unknown interpreted text role "ref".
Any idea how I can fix this?
hon.org/mailman/listinfo/python-list
>
--
Choe, Cheng-Dae(ììë)
Blog: http://www.comdongin.com/
--
http://mail.python.org/mailman/listinfo/python-list
nloaded from a web browser.
(http://i.imgur.com/l39Lc.png)
Is there anything I had missed out?
Thanks and Regards
Yan Cheng CHEOK
--
http://mail.python.org/mailman/listinfo/python-list
function_inputs:
cur_out = function_handle(**kwargs)
function_outputs.append(cur_out)
Am I missing something here? I cannot seem to get map to pass on keyword
arguments.
Thanks in advance,
Cheng Soon
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I'm trying to rewrite a c program in python & encountered several problems. I
have some data structures in my c program like below:
typedef struct
{
unsigned short size;
unsigned short reserved:8;
unsigned short var_a1:2;
unsigned short var_a2:2;
unsigned short var_a3:2;
- Original Message -
From: Stefan Behnel
To:
Sent: Tuesday, September 07, 2010 2:55 PM
Subject: Re: Bit fields in python?
If you can tell us what these structs are being used for in the original C
code, we might be able to point you to a suitable way to implement the
same
thing eff
Thanks everyone for all the suggestions! New to python, so reading up on the
struct module & Construct library now, hope to get my problem fixed soon.
- Original Message -
Bitfields are most commonly used for extreme space optimization - i.e.
shoving several variables and flags with
21 matches
Mail list logo