<commit_before>---
layout: post
title: Python 核心编程 ~ 5
categories: [blog ]
tags: [Python ]
description: Python 核心编程 第五章
---

**6-1**

in & not in

**6-2**

```python
#!usr/bin/env python

import string
import keyword

alphas = string.letters + '_'
nums = string.digits

print 'Welcome to the Identifier Checker v1.0'
print 'Testees must be at least 2 chars long.'
myInput = raw_input('Identifier to test? ')

if myInput in keyword.kwlist:
	print "myInput is keyword"


if len(myInput) == 1:

	if myInput not in alphas:
		print 'invalid: first symbol must be alphabetic'
	else:<commit_msg>update c-p-6<commit_after>---
layout: post
title: Python 核心编程 ~ 6
categories: [blog ]
tags: [Python ]
description: Python 核心编程 第六章
---

**6-1**

in & not in

**6-2**

```python
#!usr/bin/env python

import string
import keyword

alphas = string.letters + '_'
nums = string.digits

print 'Welcome to the Identifier Checker v1.0'
print 'Testees must be at least 2 chars long.'
myInput = raw_input('Identifier to test? ')

if myInput in keyword.kwlist:
	print "myInput is keyword"


if len(myInput) == 1:

	if myInput not in alphas:
		print 'invalid: first symbol must be alphabetic'
	else:
{'fraction_non_alphanumeric': 0.12085106382978723, 'fraction_numerical': 0.016170212765957447, 'mean_word_length': 3.9411764705882355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4870876', 'n_tokens_mistral': 452, 'n_tokens_neox': 441, 'n_words': 150}