Re: Windows: subprocess won't run different Python interpreter
* eryk sun (Fri, 11 Nov 2016 06:23:50 +) > > That's the application directory, which is the first place > CreateProcess looks (via the SearchPath call), as both of my examples > shows. In my case python.exe is located in the standard 3.5 system > installation path, "C:\Program Files\Python35". Okay, it looks like I read your first answer not thorough enough. So if the application's directory is always searched then the issue should be reproducible with any native (non-Cygwin) Windows interpreter: """ tcc> \PortableApps\TCC_RT\tcc.exe /c run-TEST.btm unset PATH tcc.exe /c ver TCC: C:\Documents\batch\run-TEST.btm [2] Unbekannter Befehl "tcc.exe" """ So TCC can't find itself with an empty PATH. That's how Python (subprocess) should also work. Thorsten -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows: subprocess won't run different Python interpreter
On Fri, Nov 11, 2016 at 8:56 AM, Thorsten Kampe wrote: > * eryk sun (Fri, 11 Nov 2016 06:23:50 +) >> >> That's the application directory, which is the first place >> CreateProcess looks (via the SearchPath call), as both of my examples >> shows. In my case python.exe is located in the standard 3.5 system >> installation path, "C:\Program Files\Python35". > > Okay, it looks like I read your first answer not thorough enough. > > So if the application's directory is always searched then the issue > should be reproducible with any native (non-Cygwin) Windows > interpreter: > > """ > tcc> \PortableApps\TCC_RT\tcc.exe /c run-TEST.btm > unset PATH > tcc.exe /c ver > TCC: C:\Documents\batch\run-TEST.btm [2] Unbekannter Befehl > "tcc.exe" > """ > > So TCC can't find itself with an empty PATH. That's how Python > (subprocess) should also work. If it works like cmd.exe, then it does its own search using %Path% and %PathExt%. For example: C:\>cmd /c "set "PATH=" & cmd" 'cmd' is not recognized as an internal or external command, operable program or batch file. But why should subprocess.Popen implement its own search like the shell instead of relying on CreateProcess to search for the executable? You'd have to come up with an argument to convince the devs to change the behavior in 3.7. -- https://mail.python.org/mailman/listinfo/python-list
ANN: eGenix pyOpenSSL Distribution 0.13.16
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.13.16 An easy-to-install and easy-to-use distribution of the pyOpenSSL Python interface for OpenSSL - available for Windows, Mac OS X and Unix platforms This announcement is also available on our web-site for online reading: http://www.egenix.com/company/news/eGenix-pyOpenSSL-Distribution-0.13.16.html INTRODUCTION The eGenix.com pyOpenSSL Distribution includes everything you need to get started with SSL in Python. It comes with an easy-to-use installer that includes the most recent OpenSSL library versions in pre-compiled form, making your application independent of OS provided OpenSSL libraries: http://www.egenix.com/products/python/pyOpenSSL/ pyOpenSSL is an open-source Python add-on that allows writing SSL/TLS- aware network applications as well as certificate management tools: https://launchpad.net/pyopenssl/ OpenSSL is an open-source implementation of the SSL/TLS protocol: http://www.openssl.org/ NEWS This new release of the eGenix.com pyOpenSSL Distribution includes the following updates: New in OpenSSL -- * Switched the included OpenSSL libraries to 1.0.2j. The OpenSSL 1.0.2 branch will receive long term support (LTS), so is an ideal basis for development. See https://www.openssl.org/news/secadv/20160926.txt for a complete list of security fixes in 1.0.2j. The following fixes are relevant for pyOpenSSL applications: - CVE-2016-6304 A malicious client can send an excessively large OCSP Status Request extension leading to a DoS attack. - CVE-2016-6306 Some missing message length checks can result in OOB reads, which could be used for DoS attacks. * Updated the Mozilla CA root bundle to the current version as of 2016-11-10. Please see the product changelog for the full set of changes. http://www.egenix.com/products/python/pyOpenSSL/changelog.html pyOpenSSL / OpenSSL Binaries Included - In addition to providing sources, we make binaries available that include both pyOpenSSL and the necessary OpenSSL libraries for all supported platforms: Windows, Linux, Mac OS X and FreeBSD, for x86 and x64. To simplify installation, we have uploaded a web installer to PyPI which will automatically choose the right binary for your platform, so a simple pip install egenix-pyopenssl will get you the package with OpenSSL libraries installed. Please see our installation instructions for details: http://www.egenix.com/products/python/pyOpenSSL/#Installation We have also added .egg-file distribution versions of our eGenix.com pyOpenSSL Distribution for Windows, Linux and Mac OS X to the available download options. These make setups using e.g. zc.buildout and other egg-file based installers a lot easier. DOWNLOADS The download archives and instructions for installing the package can be found at: http://www.egenix.com/products/python/pyOpenSSL/ UPGRADING Before installing this version of pyOpenSSL, please make sure that you uninstall any previously installed pyOpenSSL version. Otherwise, you could end up not using the included OpenSSL libs. ___ SUPPORT Commercial support for these packages is available from eGenix.com. Please see http://www.egenix.com/services/support/ for details about our support offerings. MORE INFORMATION For more information about the eGenix pyOpenSSL Distribution, licensing and download instructions, please visit our web-site or write to sa...@egenix.com. About eGenix (http://www.egenix.com/): eGenix is a Python software project, consulting and product company delivering expert services and professional quality products for companies, Python users and developers. We specialize in database driven applications, large scale software designs and integration. Enjoy, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Experts (#1, Nov 11 2016) >>> Python Projects, Coaching and Consulting ... http://www.egenix.com/ >>> Python Database Interfaces ... http://products.egenix.com/ >>> Plone/Zope Database Interfaces ... http://zope.egenix.com/ ::: We implement business ideas - efficiently in both time and costs ::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str
Re: Windows: subprocess won't run different Python interpreter
* eryk sun (Fri, 11 Nov 2016 09:55:23 +) > > If it works like cmd.exe, then it does its own search using %Path% > and %PathExt%. For example: > > C:\>cmd /c "set "PATH=" & cmd" > 'cmd' is not recognized as an internal or external command, > operable program or batch file. > > But why should subprocess.Popen implement its own search like the > shell instead of relying on CreateProcess to search for the > executable? You'd have to come up with an argument to convince the > devs to change the behavior in 3.7. My goal is to verify that other shells/interpreters on Windows work the same way as Python when running an application or creating a sub- process. Cmd does not. What's else there? I have Bash here but that's a Cygwin executable. And Cygwin Python does not work like Windows Python. Any ideas? Thorsten -- https://mail.python.org/mailman/listinfo/python-list
update certain key-value pairs of a dict from another dict
Hi, I have two dicts, e.g. dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} dict2 = {'A': 'aa', 'B': 'bb', 'C': 'cc'} I am wondering how to update dict1 using dict2 that only keys 'A' and 'B' of dict1 are udpated. It will result in dict1 = {'A': 'aa', 'B': 'bb', 'C': 'c'} cheers -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows: subprocess won't run different Python interpreter
On Fri, Nov 11, 2016 at 10:46 AM, Thorsten Kampe wrote: > * eryk sun (Fri, 11 Nov 2016 09:55:23 +) >> >> If it works like cmd.exe, then it does its own search using %Path% >> and %PathExt%. For example: >> >> C:\>cmd /c "set "PATH=" & cmd" >> 'cmd' is not recognized as an internal or external command, >> operable program or batch file. >> >> But why should subprocess.Popen implement its own search like the >> shell instead of relying on CreateProcess to search for the >> executable? You'd have to come up with an argument to convince the >> devs to change the behavior in 3.7. > > My goal is to verify that other shells/interpreters on Windows work > the same way as Python when running an application or creating a sub- > process. Cmd does not. What's else there? I have Bash here but that's > a Cygwin executable. And Cygwin Python does not work like Windows > Python. > > Any ideas? PowerShell uses its own search: C:\>powershell -c "$Env:Path=''; powershell" powershell : The term 'powershell' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:15 + $Env:Path=''; powershell + ~~ + CategoryInfo : ObjectNotFound: (powershell:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException These shells implement their own search because they use %PathExt% to broaden the search and then call ShellExecuteEx to be able to execute/open files that CreateProcess cannot. The only file extension that CreateProcess tries to append is .EXE. Since subprocess.Popen doesn't call ShellExecuteEx, it would make no sense for it to use a custom search that tries appending all of the file extensions in %PathExt%. Thus the only case for Popen to implement its own search is to avoid the implicit directories that CreateProcess searches ahead of %Path%. But implicitly searching the application directory and system directories ahead of %Path% is a feature for Windows applications, and Python is primarily an application development language on Windows -- not a system administration language that takes the place of the shell. -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows: subprocess won't run different Python interpreter
Thorsten Kampe wrote: > My goal is to verify that other shells/interpreters on Windows work > the same way as Python when running an application or creating a sub- > process. Cmd does not. What's else there? I have Bash here but that's > a Cygwin executable. And Cygwin Python does not work like Windows > Python. > > Any ideas? Is there a Python.exe in the Registry "App Paths". Either of these: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths or HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths -- --gv -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows: subprocess won't run different Python interpreter
On Fri, Nov 11, 2016 at 11:30 AM, Gisle Vanem via Python-list wrote: > Thorsten Kampe wrote: > >> My goal is to verify that other shells/interpreters on Windows work >> the same way as Python when running an application or creating a sub- >> process. Cmd does not. What's else there? I have Bash here but that's >> a Cygwin executable. And Cygwin Python does not work like Windows >> Python. >> >> Any ideas? > > Is there a Python.exe in the Registry "App Paths". Either of these: > HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths > or > HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths An "App Paths" key would be used by ShellExecuteEx, not CreateProcess, so it has no bearing on the behavior of subprocess.Popen with shell=False. -- https://mail.python.org/mailman/listinfo/python-list
Re: update certain key-value pairs of a dict from another dict
On 2016-11-11 11:17, Daiyue Weng wrote: > dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} > dict2 = {'A': 'aa', 'B': 'bb', 'C': 'cc'} > > I am wondering how to update dict1 using dict2 that > > only keys 'A' and 'B' of dict1 are udpated. It will result in > > dict1 = {'A': 'aa', 'B': 'bb', 'C': 'c'} Use dict1's .update() method: >>> dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} >>> dict2 = {'A': 'aa', 'B': 'bb', 'C': 'cc'} >>> desired = {'A', 'B'} >>> dict1.update({k:v for k,v in dict2.items() if k in desired}) >>> dict1 {'C': 'c', 'B': 'bb', 'A': 'aa'} or do it manually for k in dict2: if k in desired: dict1[k] = dict2[k] -tkc -- https://mail.python.org/mailman/listinfo/python-list
Reporting a Bug
Hi, System Specification: 2.7.7 |Anaconda custom (64-bit)| (default, Jun 11 2014, 10:40:02) [MSC v.1500 64 bit (AMD64)] *Issue: Spyder hangs in instances while iterating over a list containing rows with nothing in it.* for eachinfo in range(len(textlist)): #remove non-ASCII characters from the textlist textlist[eachinfo] = re.sub(r'[^\x00-\x7F]+','', textlist[eachinfo]) This results in a list *textlist*, which contains some rows with nothing in it. When such a list is iterated over (as below), Spyder hangs indefinitely. for item in textlist: print item While debugging through Spyder (Ctrl+F5), it hangs indefinitely. But, if we just run(F5), executes without a glitch. Am i doing something wrong or is it a bug? Is it related to Spyder? I am a novice to Python. Please direct me if this is not a Python issue but an Anaconda issue. Thanks, Vidya. -- https://mail.python.org/mailman/listinfo/python-list
Re: update certain key-value pairs of a dict from another dict
Tim Chase wrote: > On 2016-11-11 11:17, Daiyue Weng wrote: >> dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} >> dict2 = {'A': 'aa', 'B': 'bb', 'C': 'cc'} >> >> I am wondering how to update dict1 using dict2 that >> >> only keys 'A' and 'B' of dict1 are udpated. It will result in >> >> dict1 = {'A': 'aa', 'B': 'bb', 'C': 'c'} > > Use dict1's .update() method: > dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} dict2 = {'A': 'aa', 'B': 'bb', 'C': 'cc'} desired = {'A', 'B'} dict1.update({k:v for k,v in dict2.items() if k in desired}) dict1 > {'C': 'c', 'B': 'bb', 'A': 'aa'} > > > or do it manually > > for k in dict2: > if k in desired: > dict1[k] = dict2[k] If desired is "small" compared to the dicts: >>> for k in desired & dict1.keys() & dict2.keys(): ... dict1[k] = dict2[k] ... >>> dict1 {'A': 'aa', 'C': 'c', 'B': 'bb'} The same using update(), with a generator expression that avoids the intermediate dict: >>> dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} >>> dict1.update((k, dict2[k]) for k in desired & dict1.keys() & dict2.keys()) >>> dict1 {'A': 'aa', 'C': 'c', 'B': 'bb'} As written this will add no new keys to dict1. If you want to allow new keys use desired & dict2.keys() as the set of keys. -- https://mail.python.org/mailman/listinfo/python-list
Re: Windows: subprocess won't run different Python interpreter
On 11/11/2016 03:24 AM, eryk sun wrote: On Fri, Nov 11, 2016 at 10:46 AM, Thorsten Kampe wrote: My goal is to verify that other shells/interpreters on Windows work the same way as Python when running an application or creating a sub- process. Cmd does not. What's else there? I have Bash here but that's a Cygwin executable. And Cygwin Python does not work like Windows Python. Since subprocess.Popen doesn't call ShellExecuteEx, it would make no sense for it to use a custom search that tries appending all of the file extensions in %PathExt%. Thus the only case for Popen to implement its own search is to avoid the implicit directories that CreateProcess searches ahead of %Path%. But implicitly searching the application directory and system directories ahead of %Path% is a feature for Windows applications, and Python is primarily an application development language on Windows -- not a system administration language that takes the place of the shell. Due to backwards compatibility this is unlikely to change. However, if you can make the case that this missing functionality is important then perhaps one more parameter can be specified to Popen, or a new command added to subprocess, that deals with it. See https://mail.python.org/pipermail/python-ideas/2016-November/043620.html for some good ideas on what would be needed for such a proposal. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list
Why keys method does not work with MutableMapping?
I have a class that completely implements MutableMapping, meaning that all the abstract methods are implemented. However, the keys method no longer returns the keys, but simply a repr of the instance. Example is below. Same is true for the items method. It would seem that, if all the abstract methods have been implemented, the keys and items methods should be able to perform exactly like the native dict versions. There does not seem to be a need to override these methods. Thank you for your time. triccare Code: from collections import MutableMapping class MyDict(MutableMapping): def __init__(self, *args, **kwargs): self.data = dict(*args, **kwargs) def __getitem__(self, key): return self.data[self.__keytransform__(key)] def __setitem__(self, key, value): self.data[self.__keytransform__(key)] = value def __delitem__(self, key): del self.data[self.__keytransform__(key)] def __iter__(self): return iter(self.data) def __len__(self): return len(self.data) def __keytransform__(self, key): return key md = MyDict({'a': 1, 'b':2}) md.keys() ==> KeysView() -- https://mail.python.org/mailman/listinfo/python-list
Why keys method does not work with MutableMapping?
Greetings, Apologies if this has shown up twice; I jumped the gun sending before confirming registration. I have a class that completely implements MutableMapping, meaning that all the abstract methods are implemented. However, the keys method no longer returns the keys, but simply a repr of the instance. Example is below. Same is true for the items method. It would seem that, if all the abstract methods have been implemented, the keys and items methods should be able to perform exactly like the native dict versions. There does not seem to be a need to override these methods. Thank you for your time. triccare Code: from collections import MutableMapping class MyDict(MutableMapping): def __init__(self, *args, **kwargs): self.data = dict(*args, **kwargs) def __getitem__(self, key): return self.data[self.__keytransform__(key)] def __setitem__(self, key, value): self.data[self.__keytransform__(key)] = value def __delitem__(self, key): del self.data[self.__keytransform__(key)] def __iter__(self): return iter(self.data) def __len__(self): return len(self.data) def __keytransform__(self, key): return key md = MyDict({'a': 1, 'b':2}) md.keys() ==> KeysView() -- https://mail.python.org/mailman/listinfo/python-list
Re: Why keys method does not work with MutableMapping?
triccare triccare wrote: > Greetings, > > Apologies if this has shown up twice; I jumped the gun sending before > confirming registration. > > I have a class that completely implements MutableMapping, meaning that all > the abstract methods are implemented. However, the keys method no longer > returns the keys, but simply a repr of the instance. Example is below. > Same is true for the items method. > > It would seem that, if all the abstract methods have been implemented, the > keys and items methods should be able to perform exactly like the native > dict versions. There does not seem to be a need to override these methods. > > Thank you for your time. > triccare > > Code: > > from collections import MutableMapping > > class MyDict(MutableMapping): > > def __init__(self, *args, **kwargs): > self.data = dict(*args, **kwargs) > > def __getitem__(self, key): > return self.data[self.__keytransform__(key)] > > def __setitem__(self, key, value): > self.data[self.__keytransform__(key)] = value > > def __delitem__(self, key): > del self.data[self.__keytransform__(key)] > > def __iter__(self): > return iter(self.data) > > def __len__(self): > return len(self.data) > > def __keytransform__(self, key): > return key > > md = MyDict({'a': 1, 'b':2}) > md.keys() > ==> KeysView() Nope, that's exactly right. That's the python3 behavior. >>> d = {'a': 1, 'b':2} >>> d.keys() dict_keys(['b', 'a']) Keys returns a dedicated keys object now, not just a list. That thing you got back isn't a repr string; it's the actual object. If it were a string it'd be quoted. Try list(md.keys()). -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list
Re: update certain key-value pairs of a dict from another dict
On 2016-11-11 13:29, Peter Otten wrote: > The same using update(), with a generator expression that avoids > the intermediate dict: > > >>> dict1 = {'A': 'a', 'B': 'b', 'C': 'c'} > >>> dict1.update((k, dict2[k]) for k in desired & dict1.keys() & > dict2.keys()) Huh. Handy to file that new knowledge away. I'd not realized it could take a 2-tuple iterable, but my previous example would then be more cleanly written as dict1.update((k,v) for k,v in dict.items() if k in desired) But yes, certainly a couple edge cases depending on the dict sizes, the size of the "desired" set, and what should happen in the event dict2 (or "desired") has keys that dict1 doesn't. -tkc -- https://mail.python.org/mailman/listinfo/python-list
Promoting your own library
Hi all, what is the most appropriate way for a developer to promote his own Python library? I mean, apart from deploying it in Pypi and making the source code available in a SCV repository... Thanks. Mirko -- https://mail.python.org/mailman/listinfo/python-list
Fwd: Python does not start
Dear Sirs, when I click on the icon "IDLE (Python 3.5 32-bit)" nothing happens. It used to work and at some point it just didn't react. I have reinstalled the program several times and no improvement. I have also tried to run it as administrator, and installed other version too, but neither of them worked. I have Windows 10. What do I do? Would you please suggest how to resolve this issue? Thanks in advance, kind regards, Jelena -- https://mail.python.org/mailman/listinfo/python-list
Re: Python does not start
On Fri, Nov 11, 2016 at 8:36 PM, Jelena Tavcar wrote: > > when I click on the icon "IDLE (Python 3.5 32-bit)" nothing happens. It > used to work and at some point it just didn't react. Try running IDLE from a command prompt by entering the following command: py -3.5-32 -m idlelib If this prints an error, please provide the entire error message (copy/paste), including the complete traceback. Do not attach a screenshot; we won't get it. python-list is text only. -- https://mail.python.org/mailman/listinfo/python-list
RE: Python does not start
Did you check your Windows Event Viewer? Did you notice something wrong in Application Events? Regards Daniele Bucciero -Original Message- From: Python-list [mailto:python-list-bounces+daniele.bucciero=outlook@python.org] On Behalf Of Jelena Tavcar Sent: venerdì 11 novembre 2016 21:36 To: python-list@python.org Subject: Fwd: Python does not start Dear Sirs, when I click on the icon "IDLE (Python 3.5 32-bit)" nothing happens. It used to work and at some point it just didn't react. I have reinstalled the program several times and no improvement. I have also tried to run it as administrator, and installed other version too, but neither of them worked. I have Windows 10. What do I do? Would you please suggest how to resolve this issue? Thanks in advance, kind regards, Jelena -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list
Re: Python does not start
On 11/11/2016 3:59 PM, eryk sun wrote: On Fri, Nov 11, 2016 at 8:36 PM, Jelena Tavcar wrote: when I click on the icon "IDLE (Python 3.5 32-bit)" nothing happens. It Does python itself work? If so, which micro version. It is in the startup line that begins 'Python 3.5.2+ ...'. There was bug in 3.5.0 that was fixed in 3.5.1 which could impact this issue. (If you are not using 3.5.2, I recommend upgrading. It is very easy.) used to work and at some point it just didn't react. That means that something changed on your system, but what? Since you re-installed 'the program', by which I presume you mean python3.5, the Python and IDLE files should not be the problem. I would otherwise suggest the user config files, usually in directory C:/Users//.idlerc/, where is the account name. But since you tried both an admin and user account, that seems unlikey. Try running IDLE from a command prompt by entering the following command: py -3.5-32 -m idlelib If this prints an error, please provide the entire error message (copy/paste), including the complete traceback. Do not attach a screenshot; we won't get it. python-list is text only. Definitely do this. A third possibility is that you saved a file with the same name as an stdlib file in a place where it gets imported by IDLE instead of the stdlib module. An error message should give a hint. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Python String Handling
I have a string "Hello my name is Richard" I have a list of words as, ['Hello/Hi','my','name','is','Richard/P'] I want to identify the match of 'Hello' and 'Richard' in list, and replace them with 'Hello/Hi" and 'Richard/P' respectively. The result should look like, "Hello/Hi my name is Richard/P". Simple replace method may not work. I was trying the following script. import fuzzywuzzy from fuzzywuzzy import fuzz from fuzzywuzzy import process import itertools def sometry(): x1="Hello my name is Richard" x2=x1.split() x3=['Hello/Hi','my','name','is','Richard/P'] list1=[] for i in x2: x4=process.extractOne(i, x3) print x4 x5=x4[0] print x5 x6=[x5 if x==i else x for x in x2] print x6 list1.append(x6) b1=list1 print b1 merged = list(itertools.chain.from_iterable(b1)) merged1=list(set(merged)) print merged1 I am working in Python2.x on MS-Windows. This is a simple practice script so I have not followed style guides. Apology for any indentation error. I am trying if any one of the members may give any idea how may I achieve it. Thanks in Advance. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python String Handling
On 11/11/2016 05:29 PM, subhabangal...@gmail.com wrote: I have a string "Hello my name is Richard" I want to identify the match of 'Hello' and 'Richard' in list, and replace them with 'Hello/Hi" and 'Richard/P' respectively. The result should look like, "Hello/Hi my name is Richard/P". Simple replace method may not work. Why would simple replace not work? I.e. what's wrong with this? s = '"Hello my name is Richard"' s.replace("Hello", "Hello/Hi").replace("Richard", "Richard/P") I mean maybe you can't use that, but if you can't use that, then I'm probably not understanding your question. Cheers, Thomas -- https://mail.python.org/mailman/listinfo/python-list
Re: Python does not start
On Fri, Nov 11, 2016 at 9:38 PM, wrote: > It says that ’py-3.5-32-m’ is not recognized as an internal or external > command, operable program or batch file. There's supposed to be a space after "py". Let's add the .exe extension to make this clearer: py.exe -3.5-32 -m idlelib And please do not paraphrase error messages. Copy and paste errors verbatim. Also, make sure to reply-all to include python-list. -- https://mail.python.org/mailman/listinfo/python-list
Re: Promoting your own library
mirko bonasorte writes: > what is the most appropriate way for a developer to promote his own > Python library? The general answer is: Publish it with full metadata on PyPI. That's where the Python community looks to find third-party modules, so that's the place to put it. Beyond that? You'll need to know whom you want to promote *to*. Find out where they get their information, and participate respectfully in those forums. -- \“Sane people have an appropriate perspective on the relative | `\ importance of foodstuffs and human beings. Crazy people can't | _o__) tell the difference.” —Paul Z. Myers, 2010-04-18 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list
Re: Python String Handling
On Sat, 12 Nov 2016 09:29 am, subhabangal...@gmail.com wrote: > I have a string > "Hello my name is Richard" > > I have a list of words as, > ['Hello/Hi','my','name','is','Richard/P'] > > I want to identify the match of 'Hello' and 'Richard' > in list, and replace them with 'Hello/Hi" and 'Richard/P' > respectively. > > The result should look like, > "Hello/Hi my name is Richard/P". Looks like you want: mystring = "Hello my name is Richard" words = ['Hello/Hi', 'my', 'name', 'is', 'Richard/P'] result = " ".join(words) assert result == "Hello/Hi my name is Richard/P" and mystring is irrelevant. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. -- https://mail.python.org/mailman/listinfo/python-list