-4

a table structure to hold the different punctuation used

tbl = dict.fromkeys(i for i in xrange(sys.maxunicode) if unicodedata.category(unichr(i)).startswith('P'))

U. kaushal
  • 21
  • 2
  • 2
    Please update your question with more details about your problem, add your codes plus its output and your desired output. – Mazdak Jun 20 '18 at 11:45

2 Answers2

1
import unicodedata
tbl = dict.fromkeys(i for i in range(sys.maxunicode) if unicodedata.category(chr(i)).startswith('P'))

In python3 there is no unichr, it becomes chr. Also, there is no xrange it becomes range.

Nestor Yanchuk
  • 1,186
  • 8
  • 10
1

What about this one:

import unicodedata

tbl = dict.fromkeys(i for i in range(sys.maxunicode) if unicodedata.category(chr(i)).startswith('P'))

Some explanation:

Why is there no xrange function in Python3?

Can't use unichr in Python 3.1

Rezney
  • 371
  • 1
  • 5
  • 21