Hi there,
I'm configuring a python command to be used by emacs to filter a
buffer through python markdown, and noticed something strange. If I
run this command in the terminal:
python -c "import sys,markdown; print
markdown.markdown(sys.stdin.read().decode('utf-8'))" <
markdown_source.m
if 'ar' or 'ko' in item:
This is incorrect. What you meant to say was:
if 'ar' in item or 'ko' in item:
or something equivalent to that.
"if 'ar' or 'ko' in item" means "if ('ar') is True or ('ko' in item) is
True". Since 'ar' is True anyway, you'll get a match every time.
__
> list1 = ['ar', 'fir', 'wo']
> list2 = ['ber', 'gar', 'gt']
> list3 = ['hu', 'mo', 'ko', 'tr']
> list4 = ['q', 'wer', 'duh']
>
> whole = [list1, list2, list3, list4]
> for item in whole:
>if 'ar' or 'ko' in item:
>print item
>
> So, the unexpected result was that I got all lists printe
More thoughts on converting VFP to Python:
line-by-line can take into account control structures. One just
increases or decreases the indent when encountering the start or end of
a structure.
a bigger challenge is handling the work-area related commands such as
Scan, Replace, Skip, Set Relat
Wesley wrote:
On Mon, Dec 22, 2008 at 1:19 PM, wesley chun wrote:
>
> in addition, i think (and i may be wrong about this) that he really
> wanted to do:
>
> if 'arr' in list1 or 'bell' in list1...
>
Thanks for all the replies. Yes that was actually what I meant. My
mistake too was that I gave y
Hi John!
I have written a (currently mostly defunct) compiler in Python for a
specialized programming language. The parser may serve as an example
for you.
Introduction:
http://freeode.berlios.de/
The parser:
https://svn.berlios.de/wsvn/freeode/trunk/freeode_py/freeode/simlparser.py
The meth
Le lundi 22 décembre 2008 à 11:33 -0700, Eduardo Vieira a écrit :
> Hello, I'm trying to teach my self programming with python and there
> are some basic things that stumps me:
> Given this code:
> ###
> list1 = ['arr', 'bre', 'grau', 'lower', 'tudo']
> for item in list1:
> if 'arr' in item:
>
>> if 'arr' or 'bell' in item:
>
> The interpreter sees this as
> if ('arr') or ('bell' in item):
>
> 'arr' always evaluates to True so the condition is always true. The
> correct way to express this condition is
> if 'arr' in item or 'bell' in item:
arrgh. yes, i saw this too but forgot to ment
On Mon, Dec 22, 2008 at 1:33 PM, Eduardo Vieira wrote:
> if 'arr' or 'bell' in item:
The interpreter sees this as
if ('arr') or ('bell' in item):
'arr' always evaluates to True so the condition is always true. The
correct way to express this condition is
if 'arr' in item or 'bell' in item:
On Mon, 22 Dec 2008 09:39:37 -0800, johnf wrote:
> Well I'm attempting to convert VFP and MsSQL (stored procedures and triggers)
> to Python and Postgres (functions and triggers). Actually, python is very
> close to VFP and I would convert very well. MsSQL is another question.
Hi John,
I hope t
eduardo,
welcome to programming, and even better, welcome to Python! you've
done your research and found a list of great people who can help you
out.
with regards to your question, my comment are below...
> list1 = ['arr', 'bre', 'grau', 'lower', 'tudo']
> for item in list1:
>if 'arr' in it
I tried what Bill Campbell suggested: read the len first and then use that
to populate the structdef length field for the string
len = xstruct.structdef(xstruct.little_endian, [
('len', (xstruct. unsigned_long, 1)),
])
l = len(buf[0:3])
rec = xstruct.structdef(xstruct.little_endian, [
#! /usr/bin/python
list1 = ['arr', 'bre', 'grau', 'lower', 'tudo']
for item in list1:
if item == 'arr' or item == 'grau':
print list1
Hopefully, my rewording of one of your tests will make it a bit easier
to see what is happening.
A for statement such as 'for item in list
On Mon, Dec 22, 2008 at 12:39 PM, johnf wrote:
> I paid for and downloaded a paper from O'Reilly books on what I
> thought was going to be on 'pyparser'. But that turned out to be mostly
> theory. And nothing about the use of pyparser.
Was that "Getting Started with Pyparsing" ? I would be very
On Monday 22 December 2008 10:34:12 am Alan Gauld wrote:
> "johnf" wrote
>
> > So I ask you guys is there a link to a practical tutorial that
> > provides hands
> > on information on the use of a python parser.
>
> One place to loook for all things to do with processing text is Mertz'
> Text
> Pro
johnf wrote:
On Monday 22 December 2008 09:15:13 am bob gailer wrote:
johnf wrote:
I've been in the programming business for over 20 years and I have never
had a need for a parser. But recently I have need to convert code from
one language to a my new language python.
Pray tell
"Bryan Fodness" wrote
I would like to take a screenshot of my website without opening the
browser
I dont really know what you mean by this? The appearance of a web site
depends on many factors, not least the size of the browser window.
But different browsers render pages differently too - and
"johnf" wrote
So I ask you guys is there a link to a practical tutorial that
provides hands
on information on the use of a python parser.
One place to loook for all things to do with processing text is Mertz'
Text
Processing in Python. He discuissed parsers in some detail although,
infuri
Hello, I'm trying to teach my self programming with python and there
are some basic things that stumps me:
Given this code:
###
list1 = ['arr', 'bre', 'grau', 'lower', 'tudo']
for item in list1:
if 'arr' in item:
print list1
###
The output is (as expected):
['arr', 'bre', 'grau', 'lower
On Monday 22 December 2008 09:15:13 am bob gailer wrote:
> johnf wrote:
> > I've been in the programming business for over 20 years and I have never
> > had a need for a parser. But recently I have need to convert code from
> > one language to a my new language python.
>
> Pray tell: what is the o
Am Mon, 22 Dec 2008 07:18:41 -0800
schrieb johnf :
> I've been in the programming business for over 20 years and I have
> never had a need for a parser. But recently I have need to convert
> code from one language to a my new language python. What a better
> way to learn the new language python
Bryan Fodness wrote:
> I would like to take a screenshot of my website without opening the
> browser or importing extra packages. Is there a way to do this?
Unless you're keen on writing your own html/css/javascript/etc rendering
engine, I'm pretty sure you're going to need extra package(s), or a
johnf wrote:
I've been in the programming business for over 20 years and I have never had a
need for a parser. But recently I have need to convert code from one
language to a my new language python.
Pray tell: what is the other language, and why do you want to convert
programs?
I assume
I would like to take a screenshot of my website without opening the browser
or importing extra packages. Is there a way to do this?
I would like to create a function like screenshot('
http://www.scatterworks.com";)
--
"The game of science can accurately be described as a never-ending insult to
h
I've been in the programming business for over 20 years and I have never had a
need for a parser. But recently I have need to convert code from one
language to a my new language python. What a better way to learn the new
language python than a new project. I decided it might be time to learn
25 matches
Mail list logo