Skip to content

Commit 154ac7c

Browse files
committed
fix print
1 parent 2ff6b75 commit 154ac7c

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

Python.System/Python/print.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,25 @@ public static void print(IEnumerable @object,
5252
bool flush = false)
5353
{
5454
var _file = file ?? Console.Out;
55-
string str = "";
56-
foreach (var item in @object)
55+
if (@object is String)
5756
{
58-
str += item.ToString();
59-
str += sep;
57+
_file.Write(@object);
58+
_file.Write(end);
6059
}
60+
else
61+
{
62+
string str = "";
63+
foreach (var item in @object)
64+
{
65+
str += item.ToString();
66+
str += sep;
67+
}
6168

62-
str = str.Remove(str.Length - sep.Length, sep.Length);
69+
str = str.Remove(str.Length - sep.Length, sep.Length);
6370

64-
_file.Write(str);
65-
_file.Write(end);
71+
_file.Write(str);
72+
_file.Write(end);
73+
}
6674
if (flush) _file.Flush();
6775
}
6876
#endregion

0 commit comments

Comments
 (0)