On Tue, 02 Jul 2013 13:28:33 -0700, sas429s wrote:
> Ok here is a snippet of the text file I have:
> I hope this helps..
> .
> Thanks for your help
ok ... so you need to figure out how best to distinguish the filename,
then loop through the file, remember each filename as you find it, and
w
On 2 July 2013 21:28, wrote:
> Here I am looking for the line that contains: "WORK_MODE_MASK", I want to
> print that line as well as the file name above it:
> config/meal/governor_mode_config.h
> or config/meal/components/source/ceal_PackD_kso_aic_core_config.h.
>
> SO the output should be som
Ok here is a snippet of the text file I have:
config/meal/governor_mode_config.h
#define GOVERNOR_MODE_TASK_RATE SSS_TID_0015MSEC
#define GOVERNOR_MODE_WORK_MODE_MASK(CEAL_MODE_WORK_MASK_GEAR| \
CEAL_MODE_WORK_MASK_PARK_BRAKE | \
On 2 July 2013 20:50, Tobiah wrote:
> How do we know whether we have Sometext?
> If it's really just a literal 'Sometext', then
> just print that when you hit maskit.
>
> Otherwise:
>
>
> for line in open('file.txt').readlines():
>
> if is_sometext(line):
> memory = line
>
On 2013-07-02, Tobiah wrote:
> On 07/02/2013 12:30 PM, sas4...@gmail.com wrote:
>> Somemore can be anything for instance:
>>
>> Sometext
>> mail
>> maskit
>>
>> Sometext
>> rupee
>> dollar
>> maskit
>>
>> and so on..
>>
>> Is there a way I can achieve this?
>
> How do we know whether we have Somet
On 07/02/2013 12:30 PM, sas4...@gmail.com wrote:
Somemore can be anything for instance:
Sometext
mail
maskit
Sometext
rupee
dollar
maskit
and so on..
Is there a way I can achieve this?
How do we know whether we have Sometext?
If it's really just a literal 'Sometext', then
just print that wh
Somemore can be anything for instance:
Sometext
mail
maskit
Sometext
rupee
dollar
maskit
and so on..
Is there a way I can achieve this?
On Tuesday, July 2, 2013 2:24:26 PM UTC-5, Neil Cerutti wrote:
> On 2013-07-02, sas4...@gmail.com wrote:
>
> > I have a text file like this:
>
> >
>
> > S
On 2013-07-02, sas4...@gmail.com wrote:
> I have a text file like this:
>
> Sometext
> Somemore
> Somemore
> maskit
>
> Sometext
> Somemore
> Somemore
> Somemore
> maskit
>
> Sometext
> Somemore
> maskit
>
> I want to search for the string maskit in this file and also
> need to print Sometext abov
I have a text file like this:
Sometext
Somemore
Somemore
maskit
Sometext
Somemore
Somemore
Somemore
maskit
Sometext
Somemore
maskit
I want to search for the string maskit in this file and also need to print
Sometext above it..SOmetext location can vary as you can see above.
In the first insta
extraspecialbitter wrote:
I'm still trying to write that seemingly simple Python script to print
out network interfaces (as found in the "ifconfig -a" command) and
their speed ("ethtool "). The idea is to loop for each
interface and
print out its speed. I'm looping correctly, but have some issu
On Nov 1, 7:35 pm, Ian Kelly wrote:
> On Tue, Nov 1, 2011 at 5:19 PM, Miki Tebeka wrote:
> > In my box, there are some spaces (tabs?) before "Speed". IMO
> > re.search("Speed", line) will be a more robust.
>
> Or simply:
>
> if "Speed" in line:
>
> There is no need for a regular expression here.
On Tue, Nov 1, 2011 at 5:19 PM, Miki Tebeka wrote:
> In my box, there are some spaces (tabs?) before "Speed". IMO
> re.search("Speed", line) will be a more robust.
Or simply:
if "Speed" in line:
There is no need for a regular expression here. This would also work
and be a bit more discriminat
In my box, there are some spaces (tabs?) before "Speed". IMO re.search("Speed",
line) will be a more robust.
--
http://mail.python.org/mailman/listinfo/python-list
I'm still trying to write that seemingly simple Python script to print
out network interfaces (as found in the "ifconfig -a" command) and
their speed ("ethtool "). The idea is to loop for each
interface and
print out its speed. I'm looping correctly, but have some issues
parsing the output for al
iainemsley googlemail.com> writes:
>
> Hi,
> I'm trying to write a fairly basic text parser to split up scenes and
> acts in plays to put them into XML. I've managed to get the text split
> into the blocks of scenes and acts and returned correctly but I'm
> trying to refine this and get the rele
> Hi,
> I'm trying to write a fairly basic text parser to split up scenes and
> acts in plays to put them into XML. I've managed to get the text split
> into the blocks of scenes and acts and returned correctly but I'm
> trying to refine this and get the relevant scene number when the split
> is ma
On Wed, 06 May 2009 19:32:28 +0100, iainemsley
wrote:
Hi,
I'm trying to write a fairly basic text parser to split up scenes and
acts in plays to put them into XML. I've managed to get the text split
into the blocks of scenes and acts and returned correctly but I'm
trying to refine this and ge
iainemsley wrote:
> for scene in text.split('Scene'):
> num = re.compile("^\s\[0-9, i{1,4}, v]", re.I)
> textNum = num.match(scene)
Not related to your problem, but to your code - I'd write this as follows:
match_scene_num = re.compile("^\s\[0-9, i{1,4}, v]", re.I).match
I'm trying to write a fairly basic text parser to split up scenes and
acts in plays to put them into XML. I've managed to get the text split
into the blocks of scenes and acts and returned correctly but I'm
trying to refine this and get the relevant scene number when the split
is made but I keep g
iainemsley wrote:
Hi,
I'm trying to write a fairly basic text parser to split up scenes and
acts in plays to put them into XML. I've managed to get the text split
into the blocks of scenes and acts and returned correctly but I'm
trying to refine this and get the relevant scene number when the spl
iainemsley wrote:
Hi,
I'm trying to write a fairly basic text parser to split up scenes and
acts in plays to put them into XML. I've managed to get the text split
into the blocks of scenes and acts and returned correctly but I'm
trying to refine this and get the relevant scene number when the spl
On Wed, May 6, 2009 at 2:32 PM, iainemsley wrote:
> Hi,
> I'm trying to write a fairly basic text parser to split up scenes and
> acts in plays to put them into XML. I've managed to get the text split
> into the blocks of scenes and acts and returned correctly but I'm
> trying to refine this and g
Hi,
I'm trying to write a fairly basic text parser to split up scenes and
acts in plays to put them into XML. I've managed to get the text split
into the blocks of scenes and acts and returned correctly but I'm
trying to refine this and get the relevant scene number when the split
is made but I kee
On Jan 30, 7:39 pm, Tim Golden wrote:
> Wes James wrote:
> > If I read a windows registry file with a line like this:
>
> > "{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program
> > Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk
Wes James wrote:
If I read a windows registry file with a line like this:
"{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program
Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk Targeted
Multicast|Edge=FALSE|"
Watch out. .reg
Wes James wrote:
If I read a windows registry file with a line like this:
"{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program
Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk Targeted
Multicast|Edge=FALSE|"
with this code:
f
if s.find('LANDesk') <0:
is True for a line which doesn't contain "LANDesk"; if you want the
opposite, try
if s.find('LANDesk') >-1:
Or more pythonically, just use
if 'LANDesk' in s:
-tkc
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 30, 8:54 am, Wes James wrote:
> If I read a windows registry file with a line like this:
>
> "{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program
> Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk Targeted
> Multicast|Edge
2009/1/29 Wes James :
> If I read a windows registry file with a line like this:
>
...
>
> with this code:
>
> f=open('fwrules.reg2.txt')
>
> for s in f:
> if s.find('LANDesk') <0:
>print s,
>
>
> LANDesk is not found.
>
> how do I find LANDesk in a string like this. is the "\\" messing thing
If I read a windows registry file with a line like this:
"{C15039B5-C47C-47BD-A698-A462F4148F52}"="v2.0|Action=Allow|Active=TRUE|Dir=In|Protocol=6|Profile=Public|App=C:\\Program
Files\\LANDesk\\LDClient\\tmcsvc.exe|Name=LANDesk Targeted
Multicast|Edge=FALSE|"
with this code:
f=open('fwrules.reg2
Arnaud,
Wow!!! That's beautiful. Thank you very much!
Malcolm
I think it's straightforward enough to be dealt with simply. Here is
a solution that doesn't handle errors but should work with well-formed
input and handles recursive expansions.
expand(filename) returns an iterator over expanded
[EMAIL PROTECTED] writes:
> I'm parsing a text file for a proprietary product that has the following
> 2 directives:
>
> #include
> #define
>
> Defined constants are referenced via <#name#> syntax.
>
> I'm looking for a single text stream that results from processing a file
> containing these d
I'm parsing a text file for a proprietary product that has the following
2 directives:
#include
#define
Defined constants are referenced via <#name#> syntax.
I'm looking for a single text stream that results from processing a file
containing these directives. Even better would be an iterator(
A.T.Hofkamp wrote:
> On 2007-04-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Goodmorning people :)
>> I have just started to learn this language and i have a logical
>> problem.
>> I need to write a program to parse various file of text.
>> Here two sample:
>>
>> ---
>> trial tex
On 2007-04-12, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Goodmorning people :)
> I have just started to learn this language and i have a logical
> problem.
> I need to write a program to parse various file of text.
> Here two sample:
>
> ---
> trial text bla bla bla bla error
>
Goodmorning people :)
I have just started to learn this language and i have a logical
problem.
I need to write a program to parse various file of text.
Here two sample:
---
trial text bla bla bla bla error
bla bla bla bla bla
bla bla bla on more lines
trial text bla bla bla
On 20 Dec 2005 08:06:39 -0800, "sicvic" <[EMAIL PROTECTED]> wrote:
>Not homework...not even in school (do any universities even teach
>classes using python?). Just not a programmer. Anyways I should
>probably be more clear about what I'm trying to do.
Ok, not homework.
>
>Since I cant show the ac
Thank you everyone!!!
I got a lot more information then I expected. You guys got my brain
thinking in the right direction and starting to like programming.
You've got a great community here. Keep it up.
Thanks,
Victor
--
http://mail.python.org/mailman/listinfo/python-list
sicvic wrote:
> Not homework...not even in school (do any universities even teach
> classes using python?).
Yup, at least 6, and 20 wouldn't surprise me.
> The code I currently have looks something like this:
> ...
> f = open(sys.argv[1]) #opens output file
> #loop that goes through all lines and
sicvic wrote:
> Since I cant show the actual output file lets say I had an output file
> that looked like this:
>
> a b Person: Jimmy
> Current Location: Denver
It may be the output of another process but it's the input file as far
as the parsing code is concerned.
The code below gives t
"sicvic" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> Not homework...not even in school (do any universities even
> teach classes using python?). Just not a programmer. Anyways I
> should probably be more clear about what I'm trying to do.
>
> Since I cant show the actual output file l
Not homework...not even in school (do any universities even teach
classes using python?). Just not a programmer. Anyways I should
probably be more clear about what I'm trying to do.
Since I cant show the actual output file lets say I had an output file
that looked like this:
a b Person: J
On 19 Dec 2005 15:15:10 -0800, "sicvic" <[EMAIL PROTECTED]> wrote:
>I was wondering if theres a way where python can read through the lines
>of a text file searching for a key phrase then writing that line and
>all lines following it up to a certain point, such as until it sees a
>string of "-
sicvic wrote:
> I was wondering if theres a way where python can read through the lines
> of a text file searching for a key phrase then writing that line and
> all lines following it up to a certain point, such as until it sees a
> string of "-"
>...
> Thanks,
> Victor
You did
sicvic wrote:
> I was wondering if theres a way where python can read through the lines
> of a text file searching for a key phrase then writing that line and
> all lines following it up to a certain point, such as until it sees a
> string of "-"
>
> Right now I can only have p
I was wondering if theres a way where python can read through the lines
of a text file searching for a key phrase then writing that line and
all lines following it up to a certain point, such as until it sees a
string of "-"
Right now I can only have python write just the line
On Tue, 17 May 2005 16:44:12 -0500, Mike Meyer <[EMAIL PROTECTED]> wrote:
>"Thomas W" <[EMAIL PROTECTED]> writes:
>
>> I'm developing a web-application where the user sometimes has to enter
>> dates in plain text, allthough a format may be provided to give clues.
>> On the server side this piece o
"Thomas W" <[EMAIL PROTECTED]> writes:
> I'm developing a web-application where the user sometimes has to enter
> dates in plain text, allthough a format may be provided to give clues.
> On the server side this piece of text has to be parsed into a datetime
> python-object. Does anybody have any p
The beautiful brand new cookbook2 has "Fuzzy parsing of Dates" using
dateutil.parser, which you run once you have a decent guess at locale
(page 127 of cookbook)
John Roth wrote:
> "Thomas W" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > I'm developing a web-application where t
"Thomas W" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm developing a web-application where the user sometimes has to enter
> dates in plain text, allthough a format may be provided to give clues.
> On the server side this piece of text has to be parsed into a datetime
> python
"John Machin" <[EMAIL PROTECTED]> wrote:
> On 16 May 2005 17:51:31 -0700, "George Sakkis" <[EMAIL PROTECTED]>
> wrote:
>
>
> >#===
> >
> >def parseDateTime(string, USA=False, implyCurrentDate=False,
> > yearHeuristic=_20thcentury
On 16 May 2005 17:51:31 -0700, "George Sakkis" <[EMAIL PROTECTED]>
wrote:
>#===
>
>def parseDateTime(string, USA=False, implyCurrentDate=False,
> yearHeuristic=_20thcenturyHeuristic):
>'''Tries to parse a string as a valid d
"Thomas W" wrote:
> I'm developing a web-application where the user sometimes has to
enter
> dates in plain text, allthough a format may be provided to give
clues.
> On the server side this piece of text has to be parsed into a
datetime
> python-object. Does anybody have any pointers on this?
>
>
John Machin wrote:
> If this application is being deployed from a central server where the
> users can be worldwide, you have two options:
>
> (a) try to work out somehow what the user's locale is, and then work
> with dates in the legacy format "appropriate" to the locale.
And this inevitably sc
On 16 May 2005 13:59:31 -0700, "Thomas W" <[EMAIL PROTECTED]>
wrote:
>I'm developing a web-application where the user sometimes has to enter
>dates in plain text, allthough a format may be provided to give clues.
>On the server side this piece of text has to be parsed into a datetime
>python-objec
I'm developing a web-application where the user sometimes has to enter
dates in plain text, allthough a format may be provided to give clues.
On the server side this piece of text has to be parsed into a datetime
python-object. Does anybody have any pointers on this?
Besides the actual parsing, my
56 matches
Mail list logo