Skip to content

Commit 3801103

Browse files
authored
Python 2 compatibility for print statements (#2226)
* Python 2 compatibility for print statements * Update beta_snippets.py
1 parent 7e51a70 commit 3801103

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

speech/cloud-client/beta_snippets.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def transcribe_file_with_enhanced_model():
5858
for i, result in enumerate(response.results):
5959
alternative = result.alternatives[0]
6060
print('-' * 20)
61-
print('First alternative of result {}'.format(i))
62-
print('Transcript: {}'.format(alternative.transcript))
61+
print(u'First alternative of result {}'.format(i))
62+
print(u'Transcript: {}'.format(alternative.transcript))
6363
# [END speech_transcribe_enhanced_model_beta]
6464

6565

@@ -103,8 +103,8 @@ def transcribe_file_with_metadata():
103103
for i, result in enumerate(response.results):
104104
alternative = result.alternatives[0]
105105
print('-' * 20)
106-
print('First alternative of result {}'.format(i))
107-
print('Transcript: {}'.format(alternative.transcript))
106+
print(u'First alternative of result {}'.format(i))
107+
print(u'Transcript: {}'.format(alternative.transcript))
108108
# [END speech_transcribe_recognition_metadata_beta]
109109

110110

@@ -132,8 +132,8 @@ def transcribe_file_with_auto_punctuation():
132132
for i, result in enumerate(response.results):
133133
alternative = result.alternatives[0]
134134
print('-' * 20)
135-
print('First alternative of result {}'.format(i))
136-
print('Transcript: {}'.format(alternative.transcript))
135+
print(u'First alternative of result {}'.format(i))
136+
print(u'Transcript: {}'.format(alternative.transcript))
137137
# [END speech_transcribe_auto_punctuation_beta]
138138

139139

@@ -170,8 +170,8 @@ def transcribe_file_with_diarization():
170170

171171
# Printing out the output:
172172
for word_info in words_info:
173-
print("word: '{}', speaker_tag: {}".format(word_info.word,
174-
word_info.speaker_tag))
173+
print(u"word: '{}', speaker_tag: {}".format(
174+
word_info.word, word_info.speaker_tag))
175175
# [END speech_transcribe_diarization_beta]
176176

177177

@@ -236,7 +236,7 @@ def transcribe_file_with_multilanguage():
236236
for i, result in enumerate(response.results):
237237
alternative = result.alternatives[0]
238238
print('-' * 20)
239-
print('First alternative of result {}: {}'.format(i, alternative))
239+
print(u'First alternative of result {}: {}'.format(i, alternative))
240240
print(u'Transcript: {}'.format(alternative.transcript))
241241
# [END speech_transcribe_multilanguage_beta]
242242

0 commit comments

Comments
 (0)