hi
i am using Python with Activegrid and with the help of python i am getting some output from Server and i have to display particular values from that output
for example:
after splitting i get the string as
server o/p: yuvaraj,sfsfsf,fasdfsf,safsaf,raj,sadfsfsf,safsafsaf,safsdfa,inp,safsaf,sgsdg,inp,asdfsa,sgsdg,raj,adfsaf,sadfsaf,inp,wetwt,etwtw,raj,wrqrqr
and i need to pick the values from starting inp and the following 2 records continue's that such as inp,safsaf,sgsdg, inp,asdfsa,sgsdg inp,wetwt,etwtw
please reply ASAP
regards
7 1436 bvdet 2,851
Expert Mod 2GB
hi
i am using Python with Activegrid and with the help of python i am getting some output from Server and i have to display particular values from that output
for example:
after splitting i get the string as
server o/p: yuvaraj,sfsfsf,fasdfsf,safsaf,raj,sadfsfsf,safsafsaf,safsdfa,inp,safsaf,sgsdg,inp,asdfsa,sgsdg,raj,adfsaf,sadfsaf,inp,wetwt,etwtw,raj,wrqrqr
and i need to pick the values from starting inp and the following 2 records continue's that such as inp,safsaf,sgsdg, inp,asdfsa,sgsdg inp,wetwt,etwtw
please reply ASAP
regards
This will do something similar to the output you want: - def filter_seq(seq, keyw='inp', no_records=2):
-
return [(seq[i], seq[i+1:i+1+no_records]) for i in range(len(seq)-no_records) if seq[i]==keyw]
-
-
seq = ['yuvaraj','sfsfsf','fasdfsf','safsaf','raj','sadfsfsf','safsafsaf','safsdfa',\
-
'inp','safsaf','sgsdg','inp','asdfsa','sgsdg','raj','adfsaf','sadfsaf','inp',\
-
'wetwt','etwtw','raj','wrqrqr']
-
-
print filter_seq(seq)
Output:
>>> [('inp', ['safsaf', 'sgsdg']), ('inp', ['asdfsa', 'sgsdg']), ('inp', ['wetwt', 'etwtw'])]
bvdet 2,851
Expert Mod 2GB
This is equivalent to the code in my previous post, but iterates to the end of the sequence: - def filter_seq1(seq, keyw='inp', no_records=2):
-
output = []
-
for i, item in enumerate(seq):
-
if item == keyw:
-
output.append((item, seq[i+1:i+1+no_records]))
-
return output
-
Test: - >>> print filter_seq(seq, 'raj', 2)
-
[('raj', ['sadfsfsf', 'safsafsaf']), ('raj', ['adfsaf', 'sadfsaf'])]
-
>>> print filter_seq1(seq, 'raj', 2)
-
[('raj', ['sadfsfsf', 'safsafsaf']), ('raj', ['adfsaf', 'sadfsaf']), ('raj', ['wrqrqr'])]
-
>>>
hi
thanks for ur reply and it helpled me and now here with the same i was not able to split or replace or sub with the output:
[('inp', ['safsaf', 'sgsdg']), ('inp', ['asdfsa', 'sgsdg']), ('inp', ['wetwt', 'etwtw'])]
i need to display it as
inp, safsaf, sgsdg, inp, asdfsa, sgsdg, inp, wetwt, etwtw
without any special characters and able to be split further if possible
Reply me ASAP
regards
hi
thanks for ur reply and it helpled me and now here with the same i was not able to split or replace or sub with the output:
[('inp', ['safsaf', 'sgsdg']), ('inp', ['asdfsa', 'sgsdg']), ('inp', ['wetwt', 'etwtw'])]
i need to display it as
inp, safsaf, sgsdg, inp, asdfsa, sgsdg, inp, wetwt, etwtw
without any special characters and able to be split further if possible
Reply me ASAP
regards
hi
thanks for replying before and finally i attain my task by converting the tuple as a string and able to do all the function str()
regards
hi
here another problem and i am trying to display the output in HTML table as
before str() it is
[inp,sdfs,adsf,inp,sadf,sdfff,inp,sadf,affaf]
and i need to display it as
fun1 fun2 fun3
inp sdfs adsf
inp sadf sdfff
inp sadf affaf
but it displays as single character as
fun1 fun2 fun3
i n p
s d f
s a d
s f i
and so on...... how to convert character to string
or how to display this format
note:from inp i need only 2 strings and it will be static
reply me ASAP
regards
bvdet 2,851
Expert Mod 2GB
hi
here another problem and i am trying to display the output in HTML table as
before str() it is
[inp,sdfs,adsf,inp,sadf,sdfff,inp,sadf,affaf]
and i need to display it as
fun1 fun2 fun3
inp sdfs adsf
inp sadf sdfff
inp sadf affaf
but it displays as single character as
fun1 fun2 fun3
i n p
s d f
s a d
s f i
and so on...... how to convert character to string
or how to display this format
note:from inp i need only 2 strings and it will be static
reply me ASAP
regards
Original output from earlier post: - >>> [('inp', ['safsaf', 'sgsdg']), ('inp', ['asdfsa', 'sgsdg']), ('inp', ['wetwt', 'etwtw'])]
Reformat output string: - print '\n'.join([item for item in [' '.join([s[0], ' '.join(s[1])]) \
-
for s in filter_seq1(seq, 'inp', 2)]])
Output: - >>> inp safsaf sgsdg
-
inp asdfsa sgsdg
-
inp wetwt etwtw
-
>>>
hi
thanks for ur reply's and finally i got it with ur help
actually i am new to both python and Activegrid
thanks again
regards
Sign in to post your reply or Sign up for a free account.
Similar topics
by: srikanth |
last post by:
static char buf = {1,2,3,4,5,6,7,8};
printf("Address: %u : Val = %d \n",(int*)buf+1,*((int*)buf+1));
Thanks
Vija
|
by: Peter Rohleder |
last post by:
Hi,
I'm using a style-sheet where I make use of the
XPATH-"following-sibling"-expression.
The part which makes problems looks similar to the following code:
---------------------------
...
|
by: aditya |
last post by:
hi,
Can anybody please tell me that how the following printf(...)
statement works-
main(){
int d=9;
printf("%d",printf("%d"));
return 0;
|
by: BuddyWork |
last post by:
C function syntax is
PvcsGetRevisionInfo2(
HANDLE hArchive, /*Input */
unsigned char *filename, /*Input*/
unsigned char *revision, /*Input*/
unsigned char **author, /*Output*/
unsigned char...
|
by: zaperaj |
last post by:
Im working with python2.2 on red hat linux.
The following program is supposed to print decreasing numbers from an
entered number till 1, each decrement being = 1 :
#! usr/bin/env/python
def...
|
by: sharan |
last post by:
Using the expat parser (http://expat.sourceforge.net/) i have to parse
the following xml file and print it on the screen in tabular
format using C language. i am getting ouput serially but not in...
|
by: reachmsn |
last post by:
Hi,
At the url http://www.python.org/doc/essays/graphs.html there is some
code by Guido Van Rossum for computing paths through a graph - I have
pasted it below for reference -
Let's write a...
|
by: Nikhil.S.Ketkar |
last post by:
Hi,
Does the following construct qualify as overloading on return type ?
If not, in what way ? I overloaded the type conversion operator and
used pointers to member functions. Its pretty...
|
by: naeemzi |
last post by:
plz sir, solve me the following problum.
#include <iostream.h>
#include <windows.h>
char customer_name;
char description;
void output(char customer_name, char movie_name, char nights,...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |