Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43391
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'attribute': 0.07; 'error:': 0.07; 'problem?': 0.07; 'string': 0.09; 'deprecated': 0.09; 'lawrence': 0.09; 'python:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'subject:string': 0.09; 'python': 0.11; "'__doc__',": 0.16; "'__file__',": 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'module': 0.19; 'trying': 0.19; 'things.': 0.19; 'settings': 0.22; 'import': 0.22; 'header:User-Agent:1': 0.23; 'instead.': 0.24; 'url:moin': 0.24; 'skip:" 20': 0.27; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; "i'm": 0.30; 'code': 0.31; "skip:' 10": 0.31; 'url:wiki': 0.31; '>>>>': 0.31; 'file': 0.32; 'figure': 0.32; 'thanks!': 0.32; 'url:python': 0.33; '(most': 0.33; 'basic': 0.35; 'skip:s 30': 0.35; 'really': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'new': 0.61; "you're": 0.61; 'back': 0.62; 'charset:windows-1252': 0.65; 'effectively': 0.66; 'subject:have': 0.80 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
| Subject | Re: My string module doesn't have maketrans or translate functions |
| Date | Thu, 11 Apr 2013 17:56:51 +0100 |
| References | <338cca79-08c6-4c6f-89a4-d3a50ece3dee@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | host-92-18-43-197.as13285.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| In-Reply-To | <338cca79-08c6-4c6f-89a4-d3a50ece3dee@googlegroups.com> |
| X-Antivirus | avast! (VPS 130411-0, 11/04/2013), Outbound message |
| X-Antivirus-Status | Clean |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.488.1365699359.3114.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1365699359 news.xs4all.nl 2670 [2001:888:2000:d::a6]:47359 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:43391 |
Show key headers only | View raw
On 11/04/2013 16:30, Lamb wrote:
> Hi all,
> I'm really new to python and trying to figure out the basic rule and settings of it. I'm using python 3.3 and I was trying this code in python:
>
> import string
> s = "string. With. Punctuation?"
> out = s.translate(string.maketrans("",""), string.punctuation)
>
> And I got the following error:
> Traceback (most recent call last):
> File "C:/Python33/trials/ls.py", line 5, in <module>
> out = s.translate(string.maketrans("",""), string.punctuation)
> AttributeError: 'module' object has no attribute 'maketrans'
>
> So I used the following to see functions inside string
> e=dir(string)
>>>> print(e)
> ['ChainMap', 'Formatter', 'Template', '_TemplateMetaclass', '__builtins__', '__cached__', '__doc__', '__file__', '__initializing__', '__loader__', '__name__', '__package__', '_re', '_string', 'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'capwords', 'digits', 'hexdigits', 'octdigits', 'printable', 'punctuation', 'whitespace']
>
> It doesn't have translate(), maketrans(), rstrip() and a whole lot of other things. What's the problem?
>
> Thanks!
>
The string module is effectively dead. Many functions were deprecated
back in 2.6, maketrans in 3.1, just use string methods instead.
--
If you're using GoogleCrap™ please read this
http://wiki.python.org/moin/GoogleGroupsPython.
Mark Lawrence
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
My string module doesn't have maketrans or translate functions Lamb <lambandme@gmail.com> - 2013-04-11 08:30 -0700
Re: My string module doesn't have maketrans or translate functions Chris Angelico <rosuav@gmail.com> - 2013-04-12 01:45 +1000
Re: My string module doesn't have maketrans or translate functions Lamb <lambandme@gmail.com> - 2013-04-11 09:05 -0700
Re: My string module doesn't have maketrans or translate functions Chris Angelico <rosuav@gmail.com> - 2013-04-12 02:09 +1000
Re: My string module doesn't have maketrans or translate functions Lamb <lambandme@gmail.com> - 2013-04-11 09:05 -0700
Re: My string module doesn't have maketrans or translate functions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-04-11 17:56 +0100
Re: My string module doesn't have maketrans or translate functions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-12 00:17 +0000
csiph-web