15,190 Topics

Member Avatar for
Member Avatar for rwe0

Does anyone have actual experience with pypdf with version 3.x python ? Maybe I am confused, but looked like only a 2.x version is available. thanks

Member Avatar for rwe0
0
199
Member Avatar for munieb

i have a input file having words "Olympics,Olympics,Olympics" when i try to count them and use function readlines() it count them as 1 rather than 3 !! what should i do !! this is my code def input_files(file): sum=0 #word=raw_input('enter the word you want to search\n') file=file.readlines() for lines in …

Member Avatar for snippsat
0
169
Member Avatar for tunisia

I'm working on some simple socket programming. But I'm not on the most effective way to search for strings once I've assigned buff = skt.recv(some_length). On the client I'm writing currently, I am expecting ASCII strings, like 'mem_usage' 'ip_config' etc. Thanks.

Member Avatar for Gribouillis
0
105
Member Avatar for Plazmotech

Hello. I'm trying to make a simple language in Python. I have many functions, that handle arguments, and execute the commands. Although, the old way I was actually CALLING these functions was to have a dictionary of all the keywords to functions, and then get() it. Is these an easier …

Member Avatar for Gribouillis
0
180
Member Avatar for deepthought

Hi All, I am a control engineer and i am trying to communicate with a sensor I have spoken to the manufacturer but they cannot help with the python side.I am trying to send a message to the sensor which tells it to connect. The sensors config is ip192.168.60.3 port …

Member Avatar for TrustyTony
0
645
Member Avatar for funnymoney

A sparse vector is a vector whose entries are almost all zero, like [1, 0, 0, 0, 0, 0, 0, 2, 0]. Storing all those zeros wastes memory and dictionaries are commonly used to keep track of just the nonzero entries. For example, the vector shown earlier can be represented …

Member Avatar for TrustyTony
0
120
Member Avatar for hughesadam_87

I have a simple class that stores attributes: In [1]: class Test(object): ...: a=10 ...: b=20 I have a function that returns attributes using attrgetter, and it accepts these through the args parameter to allow a user to pass various attribute fieldnames in. For example: In [4]: def getstuff(*args): ...: …

Member Avatar for hughesadam_87
0
493
Member Avatar for tunisia

I work in the AV industry and there is a whole set of hardware/software for controlling Ip and serial devices. I'm interested in writing some python code for bench testing projectors and video teleconference unuts, as I think it would be easier and more efficient and a good way to …

Member Avatar for tunisia
0
372
Member Avatar for Iceman10284

I need help writing this program, any hints, help, guidance will be appreciated. The program needs to provide a menu to the user with the following options: Reset the deck Shuffle the deck Cut the deck Cut to a card. Cut against the computer Exit Each of these options must …

Member Avatar for HiHe
0
121
Member Avatar for Plazmotech

Hey. You all know the game dwarf fortress? I'm pretty sure it uses curses to display it's ascii characters. Although, how can I overwrite the ascii characters with my own font, like dwarf fortress? EDIT: > Post your code and ask specific questions, I can not catch the connection with …

Member Avatar for sepp2k
0
127
Member Avatar for kuchi

I 've a following query that going to use in python api. SELECT n.FIRST_NAME as "NAME", a.STREET_1 as "ST1", a.STREET_2 as "ST2" FROM SCHE.EMPLOEE_NAME n, SCHE.EMPLOYEE_ADDR a WHERE n.eid=a.eid AND n.estatus='ACTIVE' The above query yields the result cursor().execute(sqlQuery) sqlTupleRows=cursor().fetchall(); sqlQueryReturnedDict={}; for sqlTupleRow in sqlTupleRows: columns=cursor().description ...... Here the column names …

Member Avatar for ryantroop
0
206
Member Avatar for narendran_9

Hi Pythonist, I write the code in Python for search and replace the text in all XML files at current directory. But I'm unable to find and replace the text `<tex>` as empty in all XML files. Here I want to remove the text: <tex>z_{1 - \alpha }^2 \,\sigma _{{\rm …

Member Avatar for munieb
0
413
Member Avatar for MacUsers

Greetings all, I'm trying to crate some symbolic links, provided the link doesn't already exist. To do that, this is what I've done: [icode]if not os.path.islink(dst_dir): os.symlink("src_dir", "dst_dir")[/icode] but still I'm getting [icode]OSError: [Errno 17] File exists[/icode] for an existing link. Any idea what am I missing? another question, how …

Member Avatar for trsarg
0
3K
Member Avatar for 3e0jUn

How could I make the return command in Python return a list AS a list, and not as a 'programmer' list? For example, for line in list: return (line) But for some reason it only returns the first element in the list, for example: myList = ['1','2','a','b'] for line in …

Member Avatar for peterparker
0
255
Member Avatar for hughesadam_87

Hi, I've been having trouble posting a code snipet tonight, I keep getting this error: The code snippet in your post is formatted incorrectly. Please use the Code button in the editor toolbar when posting whitespace-sensitive text or curly braces. My code is running fine in wingware IDE with 4 …

Member Avatar for hughesadam_87
0
165
Member Avatar for HTMLperson5

This is a program intended to write text to any file specified var_file = (raw_input('nof$ ') #nof, number of files. try: text = str(raw_input('ttwtf$ ') #ttwtf, text to write to files. print text >>> var_file except ValueError: print "Error: Not a string" main() When the program starts the "`try`" part …

Member Avatar for HiHe
1
173
Member Avatar for jwalajoseph
Member Avatar for peterparker

0 down vote favorite I have written a code to convert decimal numbers into hexadecimal equivalent. The program prints correct value till '2559'. How to get correct values of hexadecimal for larger numbers. Here is my code: ######################################### # Decimal to Hexadecimal Conversion # ######################################### def DectoHex(n): if n <= …

Member Avatar for peterparker
0
1K
Member Avatar for hughesadam_87

I'd like to make a dictionary subclass that takes in positional keywords in addition to the standard *args, **kwargs. I found this example on stackoverflow: class attrdict(dict): def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.__dict__ = self a = attrdict(x=1, y=2) print a.x, a.y print a['x'] b.x, b.y = 1, …

Member Avatar for hughesadam_87
0
720
Member Avatar for hughesadam_87

Hi, I think I have a pretty simple question but my google searches are giving me more information than I need. I think my terminology is not clear. Let's say I'm making a dictionary to hold a datatype very specific to some filetype or data of interest. Let's say I …

Member Avatar for hughesadam_87
0
438
Member Avatar for manticmadman

I am a fledgling at best when it comes to programing. I am trying to acclimate myself with Python's date and time functions. Below is a program I wrote to calculate the Sun rise and set times for a given lat, long. What I am hoping to find out is …

Member Avatar for hughesadam_87
0
363
Member Avatar for manticmadman

I am trying to learn how to install packages into python. Asn example is http://www.clearskyinstitute.com/xephem/. I have no idea how to do this. I have viewed a variety of sites to help, but none really explain how someone with no clue can do this. Any leads welcome. Thanks

Member Avatar for TrustyTony
0
53
Member Avatar for hughesadam_87

Hi, I have been subclassing namedtuple to handle my custom data type: fields=['Query', 'u1', 'Accession] Old = namedtuple('Old', fields, verbose=False) class New(Old): def __repr__(self): return 'Overwriting works nicely' p=New('Hi',2,3) print p >>> 'Overwriting works nicely' What I want to do is to add the behavior that some of my fields …

Member Avatar for hughesadam_87
-1
150
Member Avatar for hughesadam_87

Hi guys, This is more a general discussion of methodology than a specific question. I have been working on a, the primary purpose of which is to store an oddly formatted data file (aka not you classic CSV). At the end of the day, the data is stored in a …

Member Avatar for hughesadam_87
0
156
Member Avatar for Plazmotech

As the title says, I have a flash drive, and a script on that flash drive. Whenever I plug my drive into my Mac OSX, I want a specific Python script that is on my drive to run, and be able to access directories on my computer. Why am I …

Member Avatar for Plazmotech
0
240
Member Avatar for bendoveryou

My script is sapposed to have you choose a number and then spit out that number of 1's and 2's randomly chosen and then count and post how much.could someone help me by telling me what is wrong, i would really apreciate it, here is the script(it is a cmd …

Member Avatar for TrustyTony
0
116
Member Avatar for nahsik

I am learning about networking and programming. I am trying to be a simple IM application. What i am trying to achieve having a server application route messages between computers over the internet creating a simple instant messenger. However i can't find any sort of tutorial for that. I want …

Member Avatar for extr3mex
1
322
Member Avatar for nishant.rathee

I am trying to call functions from a DLL `function oziRepositionWP(Number:integer;lat,lon:double):integer;stdcall; ` I have written the code in python no = c_int(1) lat = c_double(34.00962) lon = c_double(74.80067) var =windll.OziAPI.oziRepositionWP(byref(no),byref(lat),byref(lon)) But i get the message var =windll.OziAPI.oziRepositionWP(byref(no),byref(lat),byref(lon)) ValueError: Procedure probably called with not enough arguments (8 bytes missing) where am …

Member Avatar for HiHe
0
578
Member Avatar for Frensi

Hi again, I'm here to ask another stupid question so I apologize. I'm going to make a calculator in Python but I've ran into a wall, with the tutorials I've been following I've only ever been taught how to add two numbers together. Never have I learned how to add …

Member Avatar for HiHe
0
6K
Member Avatar for depy

Hello python world. I am new to python. I need some help in creating a table. It is an input file as <name>,<age>,<gender>,<marks>. these items can be seperated using a ','. The test part would contain mixed spaces.. e.g Jhones can be written as __JHoneS__. but if has to return …

Member Avatar for ZZucker
0
120

The End.