Answer the question
In order to leave comments, you need to log in
Python. Why does the number of tabs per line change when reading a file?
Hello!
I'm trying to write a plugin for Sublime-text. Unfortunately I don't know Python.
Here is what I have:
import os
import sublime
import sublime_plugin
class testPluginCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = os.path.dirname(os.path.realpath(__file__))
file = open(path + '/text.pattern', 'r')
result = ''
for line in file:
result += line
# result += line.expandtabs(4) # не помогает
# помещает полученную строку в редактор
self.view.run_command("insert", {"characters": result})
text.pattern
result= open(path + '/text.pattern', 'r').read()
produces the same result. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question