String constants 应用

>>> import string
>>> string.ascii_letters
‘abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ‘
>>> string.ascii_lowercase
‘abcdefghijklmnopqrstuvwxyz‘
>>> string.ascii_uppercase
‘ABCDEFGHIJKLMNOPQRSTUVWXYZ‘
>>> string.digits
‘0123456789‘
>>> string.hexdigits
‘0123456789abcdefABCDEF‘
>>> string.letters
Traceback (most recent call last):
  File "<pyshell#98>", line 1, in <module>
    string.letters
AttributeError: ‘module‘ object has no attribute ‘letters‘
>>> string.octdigits
‘01234567‘
>>> string.punctuation
‘!"#$%&\‘()*+,-./:;<=>[email protected][\\]^_`{|}~‘
>>> #punctuation[英][?p??kt?u?e??n][美][?p??kt?u?e??n]
n.标点符号
Traceback (most recent call last):
  File "<pyshell#101>", line 2, in <module>
    n.标点符号
NameError: name ‘n‘ is not defined
>>> string.printable
‘0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\‘()*+,-./:;<=>[email protected][\\]^_`{|}~ \t\n\r\x0b\x0c‘
>>> string.whitespace
‘ \t\n\r\x0b\x0c‘
时间: 2024-10-12 05:05:45

String constants 应用的相关文章

String constants

官方https://docs.python.org/3.4/library/string.html#string.Formatter 6.1. string — Common string operations Source code: Lib/string.py See also Text Sequence Type — str String Methods 6.1.1. String constants The constants defined in this module are: st

The internals of Python string interning

JUNE 28TH, 2014Tweet This article describes how Python string interning works in CPython 2.7.7. A few days ago, I had to explain to a colleague what the built-in function intern does. I gave him the following example: >>> s1 = 'foo!' >>>

Python string interning原理

原文链接:The internals of Python string interning 由于本人能力有限,如有翻译出错的,望指明. 这篇文章是讲Python string interning是如何工作的,代码基于CPython2.7.7这个版本. 前一段时间,我向同事解释了python的buil-in函数 intern背后到底做了什么.我给他看了下面这个例子: >>> s1 = 'foo!' >>> s2 = 'foo!' >>> s1 is s2

Constants and the C Preprocessor

1 #include <stdio.h> 2 #define PI 3.14159 3 int main(void){ 4 float area, circum, radius; 5 6 printf("What is the radius of your pizza>\n"); 7 scanf("%f", &radius); 8 area = PI * radius * radius; 9 circum = 2 * PI *radius;

【456】python string 类内容(去除文本标点)

主要用于 NLP 处理,里面存在一些常量列表,包括数字.字母.大写字母.小写字母.标点符号.空格等. 参考:6.1. string — Common string operations 可以用于删除文本中的标点符号,将标点符号 replace 为 空. >>> import string >>> string.punctuation '!"#$%&\'()*+,-./:;<=>[email protected][\\]^_`{|}~' &g

Android gdb so

gdb debug an android application 1.gdb 要有gdbserver 一般模拟器默认装有gdbserver,如2.3.3的模拟器,看一下有没有: D:\Developer\sdk\platform-tools>adb shell ls -l /system/bin/gdb*-rwxr-xr-x root shell 5664 2010-07-01 05:03 gdbjithelpe-rwxr-xr-x root shell 151868 2010-05-11 09

java class文件解析(一)

读取class文件,解析数据流. package readClass; import java.io.DataInputStream;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.util.ArrayList;import java.util.HashMap;import java.util

Java 编程的动态性,第 7 部分: 用 BCEL 设计字节码--转载

在本系列的最后三篇文章中,我展示了如何用 Javassist 框架操作类.这次我将用一种很不同的方法操纵字节码——使用 Apache Byte Code Engineering Library (BCEL).与 Javassist 所支持的源代码接口不同,BCEL 在实际的 JVM 指令层次上进行操作.在希望对程序执行的每一步进行控制时,底层方法使 BCEL 很有用,但是当两者都可以胜任时,它也使 BCEL 的使用比 Javassist 要复杂得多. 我将首先讨论 BCEL 基本体系结构,然后本

YASM User Manual

This document is the user manual for the Yasm assembler. It is intended as both an introduction and a general-purpose reference for all Yasm users. 1.?Introduction Yasm is a BSD-licensed assembler that is designed from the ground up to allow for mult