本文整理汇总了Python中java.io.PrintWriter.print方法的典型用法代码示例。如果您正苦于以下问题:Python PrintWriter.print方法的具体用法?Python PrintWriter.print怎么用?Python PrintWriter.print使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintWriter
的用法示例。
在下文中一共展示了PrintWriter.print方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _parse_and_rewrite_svg_file
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import print [as 别名]
def _parse_and_rewrite_svg_file(svg_input_path, svg_output_path):
write_str = ""
file_reader = FileReader(svg_input_path)
buffered_reader = BufferedReader(file_reader)
read_line = ""
while True:
read_line = buffered_reader.readLine()
if read_line is None:
break
if "viewBox" in read_line:
view_box_content = _get_viewbox_content(read_line)
view_box_values = _get_viewbox_values(view_box_content)
if view_box_values[0] != 0:
view_box_values[2] += view_box_values[0]
view_box_values[0] = 0
if view_box_values[1] != 0:
view_box_values[3] += view_box_values[1]
view_box_values[1] = 0
new_view_box = str(view_box_values[0]) + " " + str(view_box_values[1]) + " " + \
str(view_box_values[2]) + " " + str(view_box_values[3])
read_line = re.sub(r"viewBox=\"[\-|0-9| ]+\"", "viewBox=\""
+ new_view_box + "\"", read_line, 1)
read_line = re.sub(r"width=\"[0-9]+\"", "width=\""+ str(view_box_values[2]) + "\"",
read_line, 1)
read_line = re.sub(r"height=\"[0-9]+\"", "height=\""+ str(view_box_values[3]) + "\"",
read_line, 1)
write_str += read_line + "\n"
buffered_reader.close()
file_reader.close()
file_writer = PrintWriter(svg_output_path)
file_writer.print(write_str)
file_writer.close()